-1ڿƴ0{}¼ĻߵʱִеĿظʹõĴ顣

¼ĻߵʱִеĿظʹõĴ顣
ʵ
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction()
{
alert("Hello World!");
}
</script>
</head>

<body>
<button onclick="myFunction()"></button>
</body>
</html>
һ
JavaScript ﷨
ǰڻеĴ飬ǰʹ˹ؼ function
function functionname()
{
ҪִеĴ
}
øúʱִкڵĴ롣
ĳ¼ʱֱӵú統ûťʱҿ JavaScript κλýеá
ʾJavaScript ԴСдСؼ function Сдģұ뺯ͬĴСдú
ôĺ
ڵúʱ䴫ֵЩֵΪ
Щںʹá
ԷĲɶ (,) ָ
myFunction(argument1,argument2)
ʱѲΪ
function myFunction(var1,var2)
{
ҪִеĴ
}
Ͳһµ˳֡һǵһݵĲĸֵԴơ
ʵ
<button onclick="myFunction('Bill Gates','CEO')"></button>

<script>
function myFunction(name,job)
{
alert("Welcome " + name + ", the " + job);
}
</script>
һ
ĺᵱťʱʾ "Welcome Bill Gates, the CEO"
ʹòͬĲøúͻͬϢ
ʵ
<button onclick="myFunction('Harry Potter','Wizard')"></button>
<button onclick="myFunction('Bob','Builder')"></button>
һ
Ĳͬİťӻʾ "Welcome Harry Potter, the Wizard"  "Welcome Bob, the Builder"
зֵĺ
ʱǻϣֵصĵط
ͨʹ return Ϳʵ֡
ʹ return ʱִֹͣУֵָ
﷨
function myFunction()
{
var x=5;
return x;
}
ĺֵ᷵ 5
עͣ JavaScript ִֹͣУǺJavaScript ִд룬ӵúĵط
ýֵȡ
var myVar=myFunction();
myVar ֵ 5ҲǺ "myFunction()" صֵ
ʹΪҲʹ÷ֵ
document.getElementById("demo").innerHTML=myFunction();
"demo" Ԫص innerHTML Ϊ 5ҲǺ "myFunction()" صֵ
ʹֵڴݵеĲ
ʵ
ֵĳ˻ؽ
function myFunction(a,b)
{
return a*b;
}

document.getElementById("demo").innerHTML=myFunction(4,3);
"demo" Ԫص innerHTML ǣ
12
һ
ϣ˳ʱ Ҳʹ return 䡣ֵǿѡģ
function myFunction(a,b)
{
if (a>b)
  {
  return;
  }
x=a+b
}
 a  bĴ뽫˳ a  b ܺ͡
ֲ JavaScript 
 JavaScript ڲıʹ varǾֲֻںڲñǾֲģ
ڲͬĺʹͬľֲΪֻñĺʶñ
ֻҪϣرͻᱻɾ
ȫ JavaScript 
ںıȫֱҳϵнűͺܷ
JavaScript 
JavaScript ڴǱʱ俪ʼ
ֲںԺɾ
ȫֱҳرպɾ
δ JavaScript ֵ
ֵδıñԶΪȫֱ
䣺
carname="Volvo";
һȫֱ carnameʹںִС0{}{}ڻڲִͬвͬĶ

ڻڲִͬвͬĶ

ͨдʱҪΪͬľִвͬĶڴʹɸ
 JavaScript Уǿʹ䣺
if  - ֻеָΪ true ʱʹøִд
if...else  - Ϊ true ʱִд룬Ϊ false ʱִ
if...else if....else  - ʹøѡ֮һִ
switch  - ʹøѡ֮һִ
If 
ֻеָΪ true ʱŻִд롣
﷨
if ()
  {
  ֻеΪ true ʱִеĴ
  }
ע⣺ʹСд ifʹôдĸIF JavaScript 
ʵ
ʱС 20:00 ʱһGood dayʺ
if (time<20)
  {
  x="Good day";
  }
x Ľǣ
Good day
һ
ע⣬﷨Уû ..else..ѾָֻΪ true ʱִд롣
If...else 
ʹ if....else Ϊ true ʱִд룬Ϊ false ʱִ롣
﷨
if ()
  {
  Ϊ true ʱִеĴ
  }
else
  {
  Ϊ true ʱִеĴ
  }
ʵ
ʱС 20:00 ʱõʺ "Good day"򽫵õʺ "Good evening"
if (time<20)
  {
  x="Good day";
  }
else
  {
  x="Good evening";
  }
x Ľǣ
Good day
һ
If...else if...else 
ʹ if....else if...else ѡ֮һִС
﷨
if ( 1)
  {
   1 Ϊ true ʱִеĴ
  }
else if ( 2)
  {
   2 Ϊ true ʱִеĴ
  }
else
  {
   1   2 Ϊ true ʱִеĴ
  }
ʵ
ʱС 10:00򽫷ʺ "Good morning"ʱС 20:00ʺ "Good day"ʺ "Good evening"
if (time<10)
  {
  x="Good morning";
  }
else if (time<20)
  {
  x="Good day";
  }
else
  {
  x="Good evening";
  }
x Ľǣ
Good day
һ
ʵ

 W3School ΢˾ӡͨʹÿӱĻΪ 50%0{}ڻڲִͬвͬĶ0жϡжϣ{}ڻڲִͬвͬĶ0ƴѭƴΣ{}ѭԽִָĴ0ѭѭ{}ֻҪָΪ棬ѭͿһֱִд0ѭѭѭѭı塣ִһδ飬ڼǷΪ֮ǰȻΪĻͻظѭ-1Javascriptж8
ڵıд洢ֵ
﷨
();
(size);
(element0, element1, ..., elementn);

 size Ԫظص飬ԪĿ ֶνΪ size ֵ
 element ..., elementn ǲбʹЩù캯 () ʱ´ԪؾͻᱻʼΪЩֵ ԪĿ ֶҲᱻΪĸ
ֵ
´ʼ˵顣
ù캯 () ʱûʹòôصΪգԪĿ ֶΪ 0
ù캯ʱֻݸһֲù캯ؾָԪΪ undefined 顣
() ʱù캯òֵָʼ顣
ѹ캯Ϊãʹ  ʱΪʹ  ʱΪȫһ9캯              캯캯ضԴ˶麯á

÷
constructor ԷضԴ˶麯á
﷨
object.constructor
ʵ
 1
ڱУǽչʾʹ constructor ԣ
<script type="text/javascript">

var test=new Array();

if (test.constructor==Array)
{
document.write("This is an Array");
}
if (test.constructor==Boolean)
{
document.write("This is a Boolean");
}
if (test.constructor==Date)
{
document.write("This is a Date");
}
if (test.constructor==String)
{
document.write("This is a String");
}

</script>

This is an Array
TIY
 2
ڱУǽչʾʹ constructor ԣ
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.constructor);

</script>

function employee(name, jobtitle, born)
{this.name = name; this.jobtitle = job; this.born = born;}
TIY
TIY
constructor
ڱУǽչʾʹ constructor ԡ9ԪĿ              ԪĿԪĿû򷵻ԪصĿ

÷
length Կû򷵻ԪصĿ
﷨
arrayObject.length
˵
 length ǱжһԪص± 1ЩԪأԪ 0 ʼĳԣ length еԪصĸ
 length ù캯 Array() ʱʼԪʱҪ length ֵ
 length ԿɸıĴСõֵ䵱ǰֵС齫ضϣβԪؽʧõֵĵǰֵ齫µԪرӵβǵֵΪ undefined
ʵ
ڱУǽչʾʹ length Էزĳȣ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "John"
arr[1] = "Andy"
arr[2] = "Wendy"

document.write("Original length: " + arr.length)
document.write("<br />")

arr.length=5
document.write("New length: " + arr.length)

</script>

Original length: 3
New length: 5
TIY
length
ڱУǽչʾʹ length ԡ9                  ӡӡʹԺͷ

÷
prototype ʹԺͷ
﷨
object.prototype.name=value
ʵ
ڱУǽչʾʹ prototype ԣ
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

employee.prototype.salary=null;
bill.salary=20000;

document.write(bill.salary);

</script>

20000
TIY
TIY
prototype
ڱУǽչʾʹ prototype ԡ9ӣ              ӡӡ飬ؽ

÷
concat() 顣
÷ıе飬᷵رһ
﷨
arrayObject.concat(arrayX,arrayX,......,arrayX)
	
arrayX	衣òǾֵҲ󡣿
ֵ
һµ顣ͨ arrayX ӵ arrayObject ɵġҪ concat() Ĳ飬ôӵеԪأ顣
ʵ
 1
ڱУǽ concat() еĲӵ a У
<script type="text/javascript">

var a = [1,2,3];
document.write(a.concat(4,5));

</script>

1,2,3,4,5
 2
ڱУǴ飬Ȼʹ concat() 
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

var arr2 = new Array(3)
arr2[0] = "James"
arr2[1] = "Adrew"
arr2[2] = "Martin"

document.write(arr.concat(arr2))

</script>

George,John,Thomas,James,Adrew,Martin
 3
ڱУǴ飬Ȼʹ concat() 
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

var arr2 = new Array(3)
arr2[0] = "James"
arr2[1] = "Adrew"
arr2[2] = "Martin"

var arr3 = new Array(2)
arr3[0] = "William"
arr3[1] = "Franklin"

document.write(arr.concat(arr2,arr3))

</script>

George,John,Thomas,James,Adrew,Martin,William,Franklin
TIY
ʹ concat() еֵ
ʹ concat() 
ʹ concat() 9Ԫغϳַ()  䴮䴮ԪطһַԪָͨķָзָ
÷
() ڰеԪطһַ
Ԫָͨķָзָġ
﷨
.(ָ)
	
ָ	ѡָҪʹõķָʡԸòʹöΪָ
ֵ
һַַͨ  ÿԪתΪַȻЩַԪ֮ ָ ַɵġ9е              ееɾһԪ


÷
pop() ɾһԪء
﷨
arrayObject.pop()
ֵ
arrayObject һԪء
˵
pop() ɾ arrayObject һԪأ鳤ȼ 1ҷɾԪصֵѾΪգ pop() ı飬 undefined ֵ
ʵ
ڱУǽһ飬ȻɾһԪءע⣬Ҳıĳ̶ȣ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr)

document.write("<br />")

document.write(arr.pop())

document.write("<br />")

document.write(arr)

</script>

George,John,Thomas
Thomas
George,John
TIY
pop()
ʹ pop() ɾһԪء9ĩβԪأ      ӵӵĩβһԪأµĳȡ


÷
push() ĩβһԪأµĳȡ
﷨
arrayObject.push(newelement1,newelement2,....,newelementX)
	
newelement1	衣ҪӵĵһԪء
newelement2	ѡҪӵĵڶԪء
newelementX	ѡӶԪء
ֵ
ֵָӵ³ȡ
˵
push() ɰĲ˳ӵ arrayObject βֱ޸ arrayObjectǴһµ顣push()  pop() ʹṩȽջĹܡ
ʾע
עͣ÷ıĳȡ
ʾҪĿͷһԪأʹ unshift() 
ʵ
ڱУǽһ飬ͨһԪı䳤ȣ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr + "<br />")
document.write(arr.push("James") + "<br />")
document.write(arr)

</script>

George,John,Thomas
4
George,John,Thomas,James
TIY
push()
ʹ push() ıĳȡ9ߵԪ˳򣨣      ˳˳ߵԪص˳


÷
reverse() ڵߵԪص˳
﷨
arrayObject.reverse()
ʾע
עͣ÷ıԭ飬ᴴµ顣
ʵ
ڱУǽһ飬ȻߵԪص˳
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr + "<br />")
document.write(arr.reverse())

</script>

George,John,Thomas
Thomas,John,George
TIY
reverse()
ʹ reverse() ߵԪص˳򡣡9ɾصһԪ()  ССɾĵһԪ


÷
shift() ڰĵһԪشɾصһԪصֵ
﷨
arrayObject.shift()
ֵ
ԭĵһԪصֵ
˵
ǿյģô shift() κβ undefined ֵע⣬÷飬ֱ޸ԭе arrayObject
ʾע
עͣ÷ıĳȡ
ʾҪɾһԪأʹ pop() 
ʵ
ڱУǽһ飬ɾĵһԪءע⣬Ҳıĳȣ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr + "<br />")
document.write(arr.shift() + "<br />")
document.write(arr)

</script>

George,John,Thomas
George
John,Thomas
TIY
shift()
ʹ shift() ɾĵһԪء9ѡԪ()      ѡѡĳе鷵ѡԪ


÷
slice() ɴезѡԪء
﷨
arrayObject.slice(start,end)
	
start	衣涨ӺδʼѡȡǸô涨βʼλáҲ˵-1 ָһԪأ-2 ָڶԪأԴơ
end	ѡ涨ӺδѡȡòƬϽ±ꡣûָòôзֵ start ԪءǸô涨ǴβʼԪء
ֵ
һµ飬 start  end Ԫأ arrayObject еԪء
˵
ע⣬÷޸飬Ƿһ顣ɾеһԪأӦʹ÷ Array.splice()
ʾע
עͣʹøֵβѡȡԪء
עͣ end δ涨ô slice() ѡȡ start βԪء
ʵ
 1
ڱУǽһ飬ȻʾѡȡԪأ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr + "<br />")
document.write(arr.slice(1) + "<br />")
document.write(arr)

</script>

George,John,Thomas
John,Thomas
George,John,Thomas
 2
ڱУǽһ飬ȻʾѡȡԪأ
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"
arr[4] = "Adrew"
arr[5] = "Martin"

document.write(arr + "<br />")
document.write(arr.slice(2,4) + "<br />")
document.write(arr)

</script>

George,John,Thomas,James,Adrew,Martin
Thomas,James
George,John,Thomas,James,Adrew,Martin9Ԫ()        Ԫؽ


÷
sort() ڶԪؽ
﷨
arrayObject.sort(sortby)
	
sortby	ѡ涨˳򡣱Ǻ
ֵ
áע⣬ԭϽ򣬲ɸ
˵
ø÷ʱûʹòĸ˳еԪؽ˵øȷ㣬ǰַ˳Ҫʵһ㣬ӦԪضתַбҪԱбȽϡ
밴׼򣬾ҪṩȽϺúҪȽֵȻ󷵻һ˵ֵ˳֡ȽϺӦþ a  b䷵ֵ£
 a С b a Ӧó b ֮ǰ򷵻һС 0 ֵ
 a  b򷵻 0
 a  b򷵻һ 0 ֵ
ʵ
 1
ڱУǽһ飬ĸ˳
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"
arr[4] = "Adrew"
arr[5] = "Martin"

document.write(arr + "<br />")
document.write(arr.sort())

</script>

George,John,Thomas,James,Adrew,Martin
Adrew,George,James,John,Martin,Thomas
һ
 2
ڱУǽһ飬ĸ˳
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "10"
arr[1] = "5"
arr[2] = "40"
arr[3] = "25"
arr[4] = "1000"
arr[5] = "1"

document.write(arr + "<br />")
document.write(arr.sort())

</script>

10,5,40,25,1000,1
1,10,1000,25,40,5
ע⣬ĴûаֵĴСֽҪʵһ㣬ͱʹһ
<script type="text/javascript">

function sortNumber(a,b)
{
return a - b
}

var arr = new Array(6)
arr[0] = "10"
arr[1] = "5"
arr[2] = "40"
arr[3] = "25"
arr[4] = "1000"
arr[5] = "1"

document.write(arr + "<br />")
document.write(arr.sort(sortNumber))

</script>

10,5,40,25,1000,1
1,5,10,25,40,1000
һԡ9ɾԪ()    滻滻ɾԪأԪء


÷
splice() //ɾĿȻ󷵻رɾĿ
עͣ÷ıԭʼ顣
﷨
arrayObject.splice(index,howmany,item1,.....,itemX)
	
index	衣涨/ɾĿλãʹøɴβ涨λá
howmany	衣ҪɾĿΪ 0򲻻ɾĿ
item1, ..., itemX	ѡӵĿ
ֵ
	
Array	ɾĿ飬еĻ
˵
splice() ɾ index ʼԪأòбһֵ滻ЩɾԪء
 arrayObject ɾԪأ򷵻صǺбɾԪص顣
ϸ
JavaScript 汾	1.2
֧
֧ splice() 
ʾע
עͣע⣬splice()  slice() ǲͬģsplice() ֱӶ޸ġ
ʵ
 1
ڱУǽһ飬һԪأ
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"
arr[4] = "Adrew"
arr[5] = "Martin"

document.write(arr + "<br />")
arr.splice(2,0,"William")
document.write(arr + "<br />")

</script>

George,John,Thomas,James,Adrew,Martin
George,John,William,Thomas,James,Adrew,Martin
 2
ڱǽɾλ index 2 ԪأһԪɾԪأ
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"
arr[4] = "Adrew"
arr[5] = "Martin"

document.write(arr + "<br />")
arr.splice(2,1,"William")
document.write(arr)

</script>

George,John,Thomas,James,Adrew,Martin
George,John,William,James,Adrew,Martin
 3
ڱǽɾ index 2 ("Thomas") ʼԪأһԪ ("William") ɾԪأ
<script type="text/javascript">

var arr = new Array(6)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"
arr[3] = "James"
arr[4] = "Adrew"
arr[5] = "Martin"

document.write(arr + "<br />")
arr.splice(2,3,"William")
document.write(arr)

</script>

George,John,Thomas,James,Adrew,Martin
George,John,William,Martin
TIY
splice()
ʹ splice() 顣9Դ()            ԴԴظöԴ롣


÷
toSource() ʾԴ롣
ԭʼֵ Array ж̳С
toSource() ͨ JavaScript ں̨ԶãʽسڴС
﷨
object.toSource()
֧
ֻ Gecko ĵ Firefoxָ֧÷Ҳ˵ IESafariChromeOpera ָ֧÷
ʵ
չʾ toSource() ÷
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.toSource());

</script>

({name:"Bill Gates", job:"Engineer", born:1985}) 
TIY
JavaScript Array οֲ9תΪַ()    ȡȡתΪַؽ


÷
toString() ɰתΪַؽ
﷨
arrayObject.toString()
ֵ
arrayObject ַʾֵûв join() صַͬ
˵
ַʱJavaScript һԶתַĳЩ£Ҫʽصø÷
ʾע
עͣеԪ֮öŷָ
ʵ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr.toString())

</script>

George,John,Thomas
TIY
toString()
ʹ toString() 顣
JavaScript Array οֲ9ȡ()  ȡȡתΪ飬ؽ


÷
תΪַ
﷨
arrayObject.toLocaleString()
ֵ
arrayObject ıַʾ
˵
ȵÿԪص toLocaleString() Ȼʹõضķָɵַγһַ
ʵ
<script type="text/javascript">

var arr = new Array(3)
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr.toLocaleString())

</script>

George, John, Thomas
TIY
toLocaleString()
ʹ toLocaleString() 顣
JavaScript Array οֲ9鿪ͷԪ()    ͷӡͷӡĿͷһԪأµĳȡ


÷
unshift() ĿͷһԪأµĳȡ
﷨
arrayObject.unshift(newelement1,newelement2,....,newelementX)
	
newelement1	衣ӵĵһԪء
newelement2	ѡӵĵڶԪء
newelementX	ѡɸԪء
ֵ
arrayObject ³ȡ
˵
unshift() Ĳ arrayObject ͷѾڵԪ˳εƵϸߵ±괦Առ䡣÷ĵһΪԪ 0еڶΪµԪ 1Դơ
ע⣬unshift() µĴֱ޸ԭе顣
ʾע
עͣ÷ıĳȡ
עͣunshift() ޷ Internet Explorer ȷع
ʾҪһԪӵβʹ push() 
ʵ
ڱУǽһ飬һԪӵĿͷ³ȣ
<script type="text/javascript">

var arr = new Array()
arr[0] = "George"
arr[1] = "John"
arr[2] = "Thomas"

document.write(arr + "<br />")
document.write(arr.unshift("William") + "<br />")
document.write(arr)

</script>

George,John,Thomas
4
William,George,John,Thomas
TIY
unshift()
ʹ unshift() һԪӵĿͷ³ȡ
JavaScript Array οֲ9ԭʼֵ()      ȡԭֵȡԭֵԭʼֵ


÷
valueOf()  Array ԭʼֵ
ԭʼֵ Array ж̳С
valueOf() ͨ JavaScript ں̨ԶãʽسڴС
﷨
arrayObject.valueOf()
JavaScript Array οֲ8Boolean 
Boolean ʾֵ"true"  "false"
 Boolean ﷨
new Boolean(value);	//캯
Boolean(value);		//ת

 value ɲŵֵҪתɲֵֵ
ֵ
Ϊһ캯 newʱBoolean() Ĳתһֵҷһֵ Boolean 
Ϊһ newʱBoolean() ֻĲתһԭʼĲֵҷֵ
עͣʡ value Ϊ 0-0null""falseundefined  NaNöΪ falseΪ trueʹ value ַ "false"27캯                  캯캯ضԴ˶ Boolean 



÷
constructor ԷضԴ˶ Boolean á
﷨
object.constructor
ʵ
ڱУǽչʾʹ constructor ԣ
<script type="text/javascript">

var test=new Boolean();

if (test.constructor==Array)
{
document.write("This is an Array");
}
if (test.constructor==Boolean)
{
document.write("This is a Boolean");
}
if (test.constructor==Date)
{
document.write("This is a Date");
}
if (test.constructor==String)
{
document.write("This is a String");
}

</script>

This is a Boolean
TIY
TIY
constructor
ڱУǽչʾʹ constructor ԡ
JavaScript Boolean οֲ27                      ӡӡʹԺͷ





÷
prototype ʹԺͷ
﷨
object.prototype.name=value
ʵ
ڱУǽչʾʹ prototype ԣ
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

employee.prototype.salary=null;
bill.salary=20000;

document.write(bill.salary);

</script>

20000
TIY
TIY
prototype
ڱУǽչʾʹ prototype ԡ27Դ()                ԴԴظöԴ롣


÷
toSource() ʾԴ롣
ԭʼֵ Array ж̳С
toSource() ͨ JavaScript ں̨ԶãʽسڴС
﷨
object.toSource()
֧
ֻ Gecko ĵ Firefoxָ֧÷Ҳ˵ IESafariChromeOpera ָ֧÷
ʵ
չʾ toSource() ÷
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.toSource());

</script>

({name:"Bill Gates", job:"Engineer", born:1985}) 
TIY
JavaScript Array οֲ27߼ֵתΪַ()      ȡȡ߼ֵתΪַؽ


÷
toString() ɰһ߼ֵתΪַؽ
﷨
booleanObject.toString()
ֵ
ԭʼֵ booleanObject ֵַ "true"  "false"
׳
ø÷Ķ Boolean׳쳣 TypeError
ʾע
עͣ Boolean ַʱ˷ᱻԶá
ʵ
ڱУǽһ Boolean 󣬲תַ
<script type="text/javascript">
 
 var boo = new Boolean(true)
document.write(boo.toString())

</script>

true
TIY
toString()
ʹ toString() һֵתַ
JavaScript Boolean οֲ

йת֪ʶĶ JavaScript ߼̳еݣ
ECMAScript ת
ڽ ECMAScript ṩתԼνǿת27زԭʼֵ()      ȡԭֵȡԭֵ Boolean ԭʼֵ



÷
valueOf() ɷ Boolean ԭʼֵ
﷨
booleanObject.valueOf()
ֵ
booleanObject ԭʼֵ
׳
ø÷Ķ Boolean׳쳣 TypeError
ʵ
ڱУǽһ Boolean 󣬲ʹ valueOf() ȡô˶ԭʼֵ
<script type="text/javascript">

var boo = new Boolean(false)
document.write(boo.valueOf())

</script>

false
TIY
valueOf()
ʹ valueOf() ȡһ Boolean ԭʼֵ
JavaScript Boolean οֲ8ʱʱDate 
Date ڴںʱ䡣
 Date ﷨
var myDate=new Date()
עͣDate Զѵǰںʱ䱣Ϊʼֵ33캯                 캯캯÷
constructor ԷضԴ˶ Date á
﷨
object.constructor
ʵ
ڱУǽչʾʹ constructor ԣ
<script type="text/javascript">

var test=new Date();

if (test.constructor==Array)
{
document.write("This is an Array");
}
if (test.constructor==Boolean)
{
document.write("This is a Boolean");
}
if (test.constructor==Date)
{
document.write("This is a Date");
}
if (test.constructor==String)
{
document.write("This is a String");
}

</script>

This is a Date
TIY
TIY
constructor
ڱУǽչʾʹ constructor ԡ33                     ӡӡ÷
prototype ʹԺͷ
﷨
object.prototype.name=value
ʵ
ڱУǽչʾʹ prototype ԣ
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

employee.prototype.salary=null;
bill.salary=20000;

document.write(bill.salary);

</script>

20000
TIY
TIY
prototype
ڱУǽչʾʹ prototype ԡ
JavaScript Date οֲ33صյںʱ()   ǰʱǰʱصյںʱ䡣


÷
Date() ɷصںʱ䡣
﷨
Date()
ʵ
ڱУǽںʱ䣺
<script type="text/javascript">

document.write(Date())

</script>

Tue Nov 19 2013 11:19:22 GMT+0800 (China Standard Time)
TIY
Date()
ʹ Date() ȡõڡ
JavaScript Date οֲ33Date󷵻ĳ()      Date 󷵻һеĳһ (1 ~ 31)



÷
getDate() ɷ·ݵĳһ졣
﷨
dateObject.getDate()
ֵ
dateObject ָ·еĳһ죬ʹñʱ䡣ֵ 1 ~ 31 ֮һ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽǰ·ݵڣ
<script type="text/javascript">

var d = new Date()
document.write(d.getDate())

</script>

19
 2
ڱУǶһоڵı·ݵ죺
<script type="text/javascript">

var birthday = new Date("July 21, 1983 01:15:00")
document.write(birthday.getDate())

</script>

21
TIY
getDate()
ʹ getDate() ȡõǰ·ݵڡ33Date󷵻ܵĳ()  Date 󷵻һеĳһ (0 ~ 6)



÷
getDay() ɷرʾڵĳһ֡
﷨
dateObject.getDay()
ֵ
dateObject ָеĳһ죬ʹñʱ䡣ֵ 0գ  6 ֮һ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽȡڵĵǰһ죺
<script type="text/javascript">

var d=new Date()
document.write(d.getDay())

</script>

2
 2
ڣǽһ飬Ϳʹڵƣ֣
<script type="text/javascript">

var d=new Date()

var weekday=new Array(7)
weekday[0]="Sunday"
weekday[1]="Monday"
weekday[2]="Tuesday"
weekday[3]="Wednesday"
weekday[4]="Thursday"
weekday[5]="Friday"
weekday[6]="Saturday"

document.write("Today it is " + weekday[d.getDay()])

</script>

Today it is Tuesday
TIY
getDay()
ʹ getDay() һڵƣ֡
JavaScript Date οֲ33Date󷵻·()     ·ݡ·ݡ Date 󷵻· (0 ~ 11)


÷
getMonth() ɷرʾ·ݵ֡
﷨
dateObject.getMonth()
ֵ
dateObject ·ֶΣʹñʱ䡣ֵ 0һ£  11ʮ£ ֮һ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽȡõǰڣ
<script type="text/javascript">

var d=new Date()

document.write(d.getMonth())

</script>

10
 2
ڣǽһ飬·ݵƣһ֣
<script type="text/javascript">

var d=new Date()

var month=new Array(12)
month[0]="January"
month[1]="February"
month[2]="March"
month[3]="April"
month[4]="May"
month[5]="June"
month[6]="July"
month[7]="August"
month[8]="September"
month[9]="October"
month[10]="November"
month[11]="December"

document.write("The month is " + month[d.getMonth()])

</script>

The month is November
TIY
getMonth()
ʹ getMonth() ȡõǰ·ݵơ
Բͬĸʽʾǰ
ʹ getDate(), getMonth() Լ getFullYear() Բͬĸʽʾǰڡ
JavaScript Date οֲ33Dateȡλ() ݡݡ Date λַݡ



÷
getFullYear() ɷһʾݵ 4 λ֡
﷨
dateObject.getFullYear()
ֵ
 dateObject ñʱʾʱصݡֵһλʾֵڵݣλдʽ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽȡõǰݣ
<script type="text/javascript">

var d = new Date()
document.write(d.getFullYear())

</script>

2013
 2
ڱУǽӾ嵽ȡݣ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write("I was born in " + born.getFullYear())

</script>

I was born in 1983
TIY
Բͬĸʽʾǰ
ʹ getDate(), getMonth() Լ getFullYear() Բͬĸʽʾǰڡ
JavaScript Date οֲ33ȡDateļ()      Date Сʱ (0 ~ 23)



÷
getHours() ɷʱСʱֶΡ
﷨
dateObject.getHours()
ֵ
dateObject СʱֶΣԱʱʾֵ 0 ҹ  23  11 㣩֮һ
ʾעͣ
עͣ getHours() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǿȡõǰʱСʱ
<script type="text/javascript">

var d = new Date()
document.write(d.getHours())

</script>

11
 2
ڱУǽӾںʱȡСʱֶΣ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getHours())

</script>

1
TIY
ʾǰʱ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣
ʾǰʱ䣨һжֵǷС 10 ĺ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣33Dateķ()     ֡֡Dateķ


÷
getMinutes() ɷʱķֶΡ
﷨
dateObject.getMinutes()
ֵ
dateObject ķֶΣԱʱʾֵ 0 ~ 59 ֮һ
ʾעͣ
עͣ getMinutes() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǿȡõǰʱķӣ
<script type="text/javascript">

var d = new Date()
document.write(d.getMinutes())

</script>

36
 2
ڱУǽӾںʱȡֶΣ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getMinutes())

</script>

15
TIY
ʾǰʱ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣
ʾǰʱ䣨һжֵǷС 10 ĺ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣33ȡDate()        Date  (0 ~ 59)



÷
getSeconds() ɷʱ롣
﷨
dateObject.getSeconds()
ֵ
dateObject ķֶΣԱʱʾֵ 0 ~ 59 ֮һ
ʾעͣ
עͣ getSeconds() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǿȡõǰʱ룺
<script type="text/javascript">

var d = new Date()
document.write(d.getSeconds())

</script>

14
 2
ڱУǽӾںʱȡֶΣ
<script type="text/javascript">

var Birthday = new Date("July 21, 1983 01:15:00")
document.write(Birthday.getSeconds())

</script>

0
TIY
ʾǰʱ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣
ʾǰʱ䣨һжֵǷС 10 ĺ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣33Dateĺ()      Date ĺ롣


÷
getMilliseconds() ɷʱĺ롣
﷨
dateObject.getMilliseconds()
ֵ
dateObject ĺֶΣԱʱʾֵ 0 ~ 999 ֮һ
ʾעͣ
עͣ getMilliseconds() صֵһλֵ֡λģֵС 100λֵ֣С 10һλ֡
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǿȡõǰʱĺ룺
<script type="text/javascript">

var d = new Date()
document.write(d.getMilliseconds())

</script>

597
 2
ڱУǽӾںʱȡֶΣ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getMilliseconds())

</script>

0
TIY
getMilliseconds()
ʹ getMilliseconds() ȡõǰĺ롣
ʾǰʱ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣
ʾǰʱ䣨һжֵǷС 10 ĺ
ʹ getHours(), getMinutes() Լ getSeconds() ʾǰʱ䡣33ȡ1970/1/1()   7070 1970  1  1 ĺ



÷
getTime() ɷؾ 1970  1  1 ֮ĺ
﷨
dateObject.getTime()
ֵ
dateObject ָںʱ 1970  1  1 ҹGMT ʱ䣩֮ĺ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽȡô 1970/01/01 ĺ
<script type="text/javascript">

var d = new Date()
document.write(d.getTime() + " milliseconds since 1970/01/01")

</script>

1384832446842 milliseconds since 1970/01/01
 2
Уǽ 1970/01/01 ж꣺
<script type="text/javascript">

var minutes = 1000*60
var hours = minutes*60
var days = hours*24
var years = days*365
var d = new Date()
var t = d.getTime()
var y = t/years
document.write("It's been: " + y + " years since 1970/01/01!")

</script>

It's been: 43.91274882172755 years since 1970/01/01!
TIY
getTime()
ʹ getTime()  1970 жꡣ33ʱӲ()   ֲֲرʱα׼ʱ (GMT) ķӲ


÷
getTimezoneOffset() ɷظʱͱʱ֮ʱԷΪλ
﷨
dateObject.getTimezoneOffset()
ֵ
ʱ GMT ʱ֮ʱԷΪλ
˵
getTimezoneOffset() صǱʱ GMT ʱ UTC ʱ֮ķʵϣú JavaScript ʱԼָʱǷʱ
֮ԷӼƣСʱƣԭĳЩռеʱһСʱļ
ʾעͣ
עͣʹʱĹ÷ķֵһ
עͣ÷ǽһ Date ʹá
ʵ
 1
Уǽȡ GMT ʱ뱾ʱԷӼƵʱ
<script type="text/javascript">

var d = new Date()
document.write(d.getTimezoneOffset())

</script>

-480
 2
ڣǽתΪ GMT +/- Сʱ
<script type="text/javascript">

var d = new Date()
var gmtHours = d.getTimezoneOffset()/60
document.write("The local time zone is: GMT " + gmtHours)

</script>

The local time zone is: GMT -8
TIY
getTimezoneOffset()
ʹ getTimezoneOffset()  GMT ȡñʱ
JavaScript Date οֲ33ȡDate() ʱ Date 󷵻еһ (1 ~ 31)


÷
getUTCDate() ɸʱһ (UTC) еĳһ졣
﷨
dateObject.getUTCDate()
ֵ
dateObject ʱʾʱظеĳһ  1 ~ 31 еһֵ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽ UTC Լĵǰһ죺
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCDate())

</script>

20
 2
ڴ˴һоڵıȻ UTC ееһ죺
<script type="text/javascript">

var birthday = new Date("July 21, 1983 01:15:00")
document.write(birthday.getUTCDate())

</script>

21
TIY
getUTCDate()
ʹ getUTCDate() ȡôµĵǰһ죨 UTC
Բͬĸʽʾ UTC ڡ
ʹ getUTCDate(), getUTCMonth() Լ getUTCFullYear() Բͬĸʽʾ UTC ڡ33ȡDate() ʱ Date 󷵻еһ 


÷
getUTCDay() ʱرʾڵһһ֡
﷨
dateObject.getUTCDay()
ֵ
dateObject ʱʾʱظеĳһ ֵ 0죩 ~ 6 еһֵ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡñܵĵǰ UTC 죨һ֣
<script type="text/javascript">

var d=new Date()
document.write(d.getUTCDay())

</script>

3
 2
ڣҽһ飬ʹܹڵƣһ֣
<script type="text/javascript">

var d=new Date()

var weekday=new Array(7)
weekday[0]="Sunday"
weekday[1]="Monday"
weekday[2]="Tuesday"
weekday[3]="Wednesday"
weekday[4]="Thursday"
weekday[5]="Friday"
weekday[6]="Saturday"

document.write("Today it is " + weekday[d.getUTCDay()])

</script>

Today it is Wednesday
TIY
getUTCDay()
ʹ getUTCDay() һڵƣһ֡33Dateȡ·() ·ݡ·ݡʱ Date 󷵻· (0 ~ 11)



÷
getUTCMonth() ɷһʾ·ݵ֣ʱ UTC
﷨
dateObject.getUTCMonth()
ֵ
 dateObject ʱʾʱ·ݣֵ 0һ£ ~ 11ʮ£ ֮еһ
ҪעǣDate ʹ 1 ʾµĵһ죬·ֶʹ 0 һĵһ¡
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡõǰ·ݣȻ
<script type="text/javascript">

var d=new Date()

document.write(d.getUTCMonth())

</script>

10
 2
ڣǽһ飬ʹܹ·ݵƣһ֣
<script type="text/javascript">

var d=new Date()

var month=new Array(12)
month[0]="January"
month[1]="February"
month[2]="March"
month[3]="April"
month[4]="May"
month[5]="June"
month[6]="July"
month[7]="August"
month[8]="September"
month[9]="October"
month[10]="November"
month[11]="December"

document.write("The month is " + month[d.getUTCMonth()])

</script>

The month is November
TIY
getUTCMonth()
ʹ getUTCMonth() һ·ݵƣһ֡
Բͬĸʽʾ UTC 
ʹ getUTCDate(), getUTCMonth() Լ getUTCFullYear() ʹòͬĸʽʾ UTC ڡ33ͬȡλ()       ݡݡʱ Date 󷵻λݡ


÷
getUTCFullYear() ɷظʱ (UTC) ʾݵλ֡
﷨
dateObject.getUTCFullYear()
ֵ
 dateObject ʱʾʱݣֵһλλд
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
In this example we get the current year and print it:
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCFullYear())

</script>

2013
 2
Here we will extract the year out of the specific date:
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write("I was born in " + born.getUTCFullYear())

</script>

I was born in 1983
TIY
Բͬĸʽʾ UTC 
ʹ getUTCDate(), getUTCMonth() Լ getUTCFullYear() ʹòͬĸʽʾ UTC ڡ33ͬȡ()           ʱ Date Сʱ (0 ~ 23)



÷
getUTCHours() ɸʱ (UTC) ʱСʱ
﷨
dateObject.getUTCHours()
ֵ
 dateObject ʱʾʱСʱֶΣֵһ 0ҹ ~ 23 11 㣩 ֮
ʾעͣ
עͣ getUTCHours() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡõǰʱ UTC Сʱ
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCHours())

</script>

7
 2
ǽӾںʱȡ UTC Сʱ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getUTCHours())

</script>

17
TIY
ʾǰ UTC ʱ
ʹ getUTCHours() ʾǰ UTC ʱ䡣
ʾǰ UTC ʱ䣨һжֵǷС 10 ĺ
ʹ getUTCHours(), getUTCMinutes() Լ getUTCSeconds() ʾǰ UTC ʱ䡣33ͬȡ()             ֡֡ʱ Date ķ (0 ~ 59)


÷
getUTCMinutes() ɸʱ (UTC) ʱķֶΡ
﷨
dateObject.getUTCMinutes()
ֵ
 dateObject ʱʾʱķֶΣֵһ 0 ~ 59 ֮
ʾעͣ
עͣ getUTCMinutes() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡõǰʱ UTC ӣ
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCMinutes())

</script>

59
 2
ڴ˴ǽӾںʱȡ UTC ӣ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getUTCMinutes())

</script>

15
TIY
ʾǰ UTC ʱ
ʹ getUTCHours() ʾǰ UTC ʱ䡣
ʾǰ UTC ʱ䣨һжֵǷС 10 ĺ
ʹ getUTCHours(), getUTCMinutes() Լ getUTCSeconds() ʾǰ UTC ʱ䡣33ͬȡ()             ʱ Date  (0 ~ 59)


÷
getUTCSeconds() ɸʱʱ롣
﷨
dateObject.getUTCSeconds()
ֵ
 dateObject ʱʾʱֶΣֵһ 0 ~ 59 ֮
ʾעͣ
עͣ getUTCSeconds() صֵһλֵ֡λģֵС 10һλ֡
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡõǰʱ UTC 룺
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCSeconds())

</script>

45
 2
ڴ˴ǽӾںʱȡ UTC 룺
<script type="text/javascript">

var Birthday = new Date("July 21, 1983 01:15:00")
document.write(Birthday.getUTCSeconds())

</script>

0
TIY
ʾǰ UTC ʱ
ʹ getUTCHours() ʾǰ UTC ʱ䡣
ʾǰ UTC ʱ䣨һжֵǷС 10 ĺ
ʹ getUTCHours(), getUTCMinutes() Լ getUTCSeconds() ʾǰ UTC ʱ䡣33ͬȡ()             ʱ Date ĺ(0 ~ 999)


÷
getUTCMilliseconds() ɸʱ (UTC) ʱĺ롣
﷨
dateObject.getUTCMilliseconds()
ֵ
 dateObject ʱʾʱĺֶΣֵһ 0 ~ 999 ֮
ʾעͣ
עͣ getUTCMilliseconds() صֵһλֵ֡λģֵС 100λֵ֣С 10һλ֡
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽȡõǰʱ UTC 룺
<script type="text/javascript">

var d = new Date()
document.write(d.getUTCMilliseconds())

</script>

850
 2
ڴ˴ǽӾںʱȡ UTC 룺
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getUTCMilliseconds())

</script>

0
עͣĴ뽫ѺΪ 1ûж롣
TIY
getUTCMilliseconds()
ʹ getUTCMilliseconds() ȡõǰ UTC 롣
ʾǰ UTC ʱ
ʹ getUTCHours() ʾǰ UTC ʱ䡣
ʾǰ UTC ʱ䣨һжֵǷС 10 ĺ
ʹ getUTCHours(), getUTCMinutes() Լ getUTCSeconds() ʾǰ UTC ʱ䡣33ȡ1970/1/1ָ()   ںں197011ҹָڣַĺ


÷
parse() ɽһʱַ 1970/1/1 ҹʱĺ
﷨
Date.parse(datestring)
	
datestring	衣ʾںʱַ
ֵ
ָںʱ 1970/1/1 ҹGMT ʱ䣩֮ĺ
˵
÷ Date ľ̬һ Date.parse() ʽãͨ dateobject.parse() ø÷
ʾעͣ
עͣDate.parse()  Date ľ̬
ʵ
 1
ڱУǽȡô 1970/01/01  2005/07/08 ĺ
<script type="text/javascript">

var d = Date.parse("Jul 8, 2005")
document.write(d)

</script>

1120752000000
 2
ڣǽĽת꣺
<script type="text/javascript">

var minutes = 1000 * 60
var hours = minutes * 60
var days = hours * 24
var years = days * 365
var t = Date.parse("Jul 8, 2005")
var y = t/years
document.write("It's been: " + y + " years from 1970/01/01")
document.write(" to 2005/07/08!")

</script>

It's been: 35.538812785388124 years from 1970/01/01 to 2005/07/08!
TIY
parse()
ʹ parse()  1970/01/01 һڵĺ33Dateĳһ()  Date µĳһ (1 ~ 31)


÷
setDate() һµĳһ졣
﷨
dateObject.setDate(day)
	
day	衣ʾһеһһֵ1 ~ 31
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
ڱУǽͨ setDate() ѵǰµΪ 15
<script type="text/javascript">

var d = new Date()
d.setDate(15)
document.write(d)

</script>

Fri Nov 15 2013 14:00:33 GMT+0800 (China Standard Time)
TIY
setDate()
ʹ setDate() õǰµĳһ졣33 Date ·()   ·ݡ·ݡ Date · (0 ~ 11)


÷
setMonth() ·ݡ
﷨
dateObject.setMonth(month,day)
	
month	衣һʾ·ݵֵֵ 0һ£ ~ 11ʮ£ ֮䡣
day	
ѡһʾµĳһֵֵ 1 ~ 31 ֮䣨Աʱƣ
 EMCAScript ׼֮ǰָ֧ò
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽͨ setMonth() Ѷ d ֶΪ 0 һ£
<script type="text/javascript">

var d=new Date()
d.setMonth(0)
document.write(d)

</script>

Mon Jan 21 2013 14:01:56 GMT+0800 (China Standard Time)
 2
ڱУǽͨ setMonth() Ѷ d ֶΪ 0 һ£ֶΪ 20
<script type="text/javascript">

var d=new Date()
d.setMonth(0,20)
document.write(d)

</script>

Sun Jan 20 2013 14:01:56 GMT+0800 (China Standard Time)
TIY
setMonth()
ʹ setMonth() ·ݡ33Dateλ() ݡݡ Date еݣλ֣


÷
setFullYear() ݡ
﷨
dateObject.setFullYear(year,month,day)
	
year	衣ʾݵλñʱʾ
month	ѡʾ·ݵֵ 0 ~ 11 ֮䡣ñʱʾ
day	ѡʾĳһֵ 1 ~ 31 ֮䡣ñʱʾ
ֵ
صڵĺʾ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽͨ setFullYear() Ϊ1992
<script type="text/javascript">

var d = new Date()
d.setFullYear(1992)
document.write(d)

</script>

Sat Nov 21 1992 14:03:00 GMT+0800 (China Standard Time)
 2
ڱУǽͨ setFullYear() Ϊ November 3, 1992
<script type="text/javascript">

var d = new Date()
d.setFullYear(1992,10,3)
document.write(d)

</script>

Tue Nov 03 1992 14:03:00 GMT+0800 (China Standard Time)
TIY
setFullYear()
ʹ setFullYear() ݡ
ʹ setFullYear() þ
ʹ setFullYear() þڡ33Ϸ()   ݶݶʹ setFullYear() 档



÷
setYear() ݡ
﷨
dateObject.setYear(year)
	
year	衣ʾݵλλ֡
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣ year λ֣ setYear(91)÷Ϊ 1991Ҫ涨 1990 ֮ǰ 1999 ֮ݣʹλ֡
עͣ÷ǽһ Date ʹá
Ҫ ECMAScript v3 JavaScript ʵֲҪʹøúʹ setFullYear() 
ʵ
ڱУǽͨ setYear() Ϊ 1891
<script type="text/javascript">

var d = new Date()
d.setYear(1891)
document.write(d)

</script>

Sat Nov 21 1891 14:04:23 GMT+0800 (China Standard Time)
TIY
setYear()
ʹ setYear() ݡ33DateСʱ()       üü Date еСʱ (0 ~ 23)


÷
setHours() ָʱСʱֶΡ
﷨
dateObject.setHours(hour,min,sec,millisec)
	
hour	衣ʾСʱֵ 0ҹ ~ 2311㣩 ֮䣬Աʱƣͬ
min	ѡʾӵֵ 0 ~ 59 ֮䡣 EMCAScript ׼֮ǰָ֧ò
sec	ѡʾֵ 0 ~ 59 ֮䡣 EMCAScript ׼֮ǰָ֧ò
millisec	ѡʾֵ 0 ~ 999֮䡣 EMCAScript ׼֮ǰָ֧ò
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽͨ setHours() ѵǰʱСʱֶΪ 15
<script type="text/javascript">

var d = new Date()
d.setHours(15)
document.write(d)

</script>

Thu Nov 21 2013 15:08:07 GMT+0800 (China Standard Time)
 2
ڱУǽͨ setHours() ʱΪ 15:35:01
<script type="text/javascript">

var d = new Date()
d.setHours(15,35,1)
document.write(d)

</script>

Thu Nov 21 2013 15:35:01 GMT+0800 (China Standard Time)
TIY
setHours()
ʹ setHours() ʱ䡣33Dateеķ()   ü֡ü֡ Date еķ (0 ~ 59)



÷
setMinutes() ָʱķֶΡ
﷨
dateObject.setMinutes(min,sec,millisec)
	
min	衣ʾӵֵ 0 ~ 59 ֮䣬Աʱƣͬ
sec	ѡʾֵ 0 ~ 59 ֮䡣 EMCAScript ׼֮ǰָ֧ò
millisec	ѡʾֵ 0 ~ 999 ֮䡣 EMCAScript ׼֮ǰָ֧ò
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʵ
ڱУǽͨ setMinutes() ѵǰʱķֶΪ 01
<script type="text/javascript">

var d = new Date()
d.setMinutes(1)
document.write(d)

</script>

Thu Nov 21 2013 14:01:52 GMT+0800 (China Standard Time)
TIY
setMinutes()
ʹ setMinutes() õǰʱķӡ33 Date е() üü Date е (0 ~ 59)


÷
The setSeconds() method is used to set the seconds of a specified time.
﷨
dateObject.setSeconds(sec,millisec)
	
sec	衣ʾֵֵǽ 0 ~ 59 ֮
millisec	ѡʾֵ 0 ~ 999 ֮䡣 EMCAScript ׼֮ǰָ֧ò
ֵ
ڵĺʾ ECMAScript ׼֮ǰ÷ʲôء
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʵ
ڱУǽͨ setSeconds() ѵǰʱֶΪ 01
<script type="text/javascript">

var d = new Date()
d.setSeconds(1)
document.write(d)

</script>

Thu Nov 21 2013 14:10:01 GMT+0800 (China Standard Time)
TIY
setSeconds()
ʹ setSeconds() õǰʱ롣33 Date еĺ() úú Date еĺ (0 ~ 999)


÷
setMilliseconds() ָʱĺֶΡ
﷨
dateObject.setMilliseconds(millisec)
	
millisec	衣 dateObject ֶΣòǽ 0 ~ 999 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʵ
ڱУǽͨ setMilliseconds() ѵǰʱĺֶΪ 001
<script type="text/javascript">

var d = new Date()
d.setMilliseconds(1)
document.write(d)

</script>

Thu Nov 21 2013 14:11:44 GMT+0800 (China Standard Time)
TIY
setMilliseconds()
ʹ setMilliseconds() ĵǰĺ롣331970/01/01ɺ() ӺӺԺ Date 


÷
setTime() Ժ Date 
﷨
dateObject.setTime(millisec)
	
millisec	衣Ҫõںʱ GMT ʱ 1970  1  1 ҹ֮ĺ͵ĺֵԴݸ Date() 캯ͨ Date.UTC()  Date.parse() øֵԺʽʾڿʹʱ
ֵ
ز millisec ECMAScript ׼֮ǰ÷ֵ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʵ
 1
ڱУǽ 1970/01/01  77771564221 룬ʾµںʱ䣺
<script type="text/javascript">

var d = new Date()
d.setTime(77771564221)
document.write(d)

</script>

Mon Jun 19 1972 11:12:44 GMT+0800 (China Standard Time)
 2
ڱУǽ 1970/01/01 ȥ 77771564221 룬ʾµںʱ䣺
<script type="text/javascript">

var d = new Date()
d.setTime(-77771564221)
document.write(d)

</script>

Sun Jul 16 1967 04:47:15 GMT+0800 (China Standard Time)
TIY
setTime()
ʹ setTime()  1970/01/01 Ӻ룬ʾµںʱ䡣33ʱ·ĳ() ʱ Date ·ݵһ (1 ~ 31)


÷
setUTCDate() ڸʱ (UTC) һеĳһ졣
﷨
dateObject.setUTCDate(day)
	
day	衣Ҫ dateObject õһеĳһ죬ʱʾò 1 ~ 31 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
ڱУǽͨ setUTCDate() ѵǰµֶΪ 15
<script type="text/javascript">

var d = new Date()
d.setUTCDate(15)
document.write(d)

</script>

Fri Nov 15 2013 14:15:49 GMT+0800 (China Standard Time)
TIY
setUTCDate()
ʹ setUTCDate() ôµ졣33ʱ·()     ·ݡ·ݡʱ Date е· (0 ~ 11)


÷
setUTCMonth() ڸʱ (UTC) ·ݡ
﷨
dateObject.setUTCMonth(month,day)
	
month	
衣Ҫ dateObject õ·ֶεֵʱʾ
ò 0һ£ ~ 11ʮ£ ֮
day	ѡ 1 ~ 31 ֮ dateObject ֶΣʱʾ
ֵ
ڵĺʾ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽͨ setUTCMonth() ֶΪ 0 һ£
<script type="text/javascript">

var d=new Date()
d.setUTCMonth(0)
document.write(d)

</script>

Mon Jan 21 2013 14:17:11 GMT+0800 (China Standard Time)
 2
ڱУǽͨ setUTCMonth() ·Ϊ 0 һ£ֶΪ 20
<script type="text/javascript">

var d=new Date()
d.setUTCMonth(0,20)
document.write(d)

</script>

Sun Jan 20 2013 14:17:11 GMT+0800 (China Standard Time)
TIY
setUTCMonth()
ʹ setUTCMonth() ·ݡ33λ() ݡݡʱ Date еݣλ֣


÷
setUTCFullYear() ڸʱ (UTC) ݡ
﷨
dateObject.setUTCFullYear(year,month,day)
	
year	
衣Ҫ dateObject õֶεֵ
òӦǺֵݣ 1999ֻдֵ 99
month	
ѡҪ dateObject õ·ֶεֵʹʱʾ
ò 0 ~ 11 ֮
day	
ѡҪ dateObject õֶεֵʹʱʾ
ò 1 ~ 31 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽͨ setUTCFullYear() Ϊ 1992
<script type="text/javascript">

var d = new Date()
d.setUTCFullYear(1992)
document.write(d)

</script>

Sat Nov 21 1992 14:18:33 GMT+0800 (China Standard Time)
 2
ڱУҽͨ setUTCFullYear() Ϊ November 3, 1992
<script type="text/javascript">

var d = new Date()
d.setUTCFullYear(1992,10,3)
document.write(d)

</script>

Tue Nov 03 1992 14:18:33 GMT+0800 (China Standard Time)
TIY
setUTCFullYear()
ʹ setUTCFullYear() ݡ33ʱСʱ()     üüʱ Date еСʱ (0 ~ 23)

÷
setUTCHours() ڸʱ (UTC) Сʱ0 - 23
﷨
dateObject.setUTCHours(hour,min,sec,millisec)
	
hour	
衣Ҫ dateObject õСʱֶεֵ
ò 0 ~ 23 ֮
min	
ѡҪ dateObject õķֶεֵ
ò 0 ~ 59 ֮
sec	
ѡҪ dateObject õֶεֵ
ò 0 ~ 59 ֮
millisec	
ѡҪ dateObject õĺֶεֵ
ò 1 ~ 999 ֮
˵
ûй涨 min, sec Լ millisec ʹô getUTCMinutes, getUTCSeconds Լ getUTCMilliseconds صֵ
涨ĲָΧ֮⣬ setUTCHours Ծݴ Date еϢ磬 sec ֵ 100 1  (min + 1)Ϊ 40
ֵ
ڵĺʾ
ʾעͣ
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
 1
ڱУǽͨ setUTCHours()  UTC СʱΪ 23
<script type="text/javascript">

var d = new Date();
d.setUTCHours(23);
document.write(d);

</script>

Fri Nov 22 2013 07:19:57 GMT+0800 (China Standard Time)
һ
 2
ڱУǽͨ setUTCHours()  UTC СʱΪ 23:15:06 
<script type="text/javascript">

var d = new Date();
d.setUTCHours(23,15,6);
document.write(d);

</script>

Fri Nov 22 2013 07:15:06 GMT+0800 (China Standard Time)
һ
TIY
setUTCHours()
ʹ setUTCHours() Сʱ33ʱ÷()     ü֡ü֡ʱ Date еķ (0 ~ 59)


÷
setUTCMinutes() ڸʱ (UTC) ָʱķӡ
﷨
dateObject.setUTCMinutes(min,sec,millisec)
	
min	
衣Ҫ dateObject õķֶεֵʱʾ
òӦ 0 ~ 59 ֮
sec	
ѡҪ dateObject õֶεֵʹʱʾ
ò 0 ~ 59 ֮
millisec	
ѡҪ dateObject õĺֶεֵʹʱʾ
ò 0 ~ 999 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
ڱУǽͨ setUTCMinutes() ѵǰʱķֶΪ 01
<script type="text/javascript">

var d = new Date()
d.setUTCMinutes(1)
document.write(d)

</script>

Thu Nov 21 2013 14:01:15 GMT+0800 (China Standard Time)
TIY
setUTCMinutes()
ʹ setUTCMinutes() õǰʱķӡ33ʱ()     üüʱ Date е (0 ~ 59)


÷
setUTCSeconds() ڸʱ (UTC) ָʱ롣
﷨
dateObject.setUTCSeconds(sec,millisec)
	
sec	
衣Ҫ dateObject õֶεֵʹʱʾ
ò 0 ~ 59 ֮
millisec	
ѡҪ dateObject õĺֶεֵʹʱʾ
ò 0 ~ 999 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
ڱУǽͨ setUTCSeconds() ѵǰʱֶΪ 01
<script type="text/javascript">

var d = new Date()
d.setUTCSeconds(1)
document.write(d)

</script>

Thu Nov 21 2013 14:28:01 GMT+0800 (China Standard Time)
TIY
setUTCSeconds()
ʹ setUTCSeconds() õǰʱ롣33ʱú()     úúʱ Date еĺ (0 ~ 999)


÷
setUTCMilliseconds() ڸʱ (UTC) ָʱĺ롣
﷨
dateObject.setUTCMilliseconds(millisec)
	
millisec	
衣Ҫ dateObject õĺֶεֵʹʱʾ
ò 0 ~ 999 ֮
ֵ
ڵĺʾ
ʾעͣ
עͣĲ֮һʹһλ涨ô JavaScript ڽмһǰ 0
עͣ÷ǽһ Date ʹá
ʾйͨЭʱ (UTC) ĸϣİٶȰٿơ
ʵ
ڱУǽͨ setUTCMilliseconds() ѵǰʱĺֶΪ 001
<script type="text/javascript">

var d = new Date()
d.setUTCMilliseconds(1)
document.write(d)

</script>

Thu Nov 21 2013 14:29:46 GMT+0800 (China Standard Time)
TIY
setUTCMilliseconds()
ʹ setUTCMilliseconds() õǰʱĺ롣33ظöԴ()     ԴԴظöԴ롣


÷
toSource() رʾԴַ
﷨
object.toSource()
ʾע
עͣ÷ Internet Explorer Ч
ʵ
չʾ toSource() ÷
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.toSource());

</script>

({name:"Bill Gates", job:"Engineer", born:1985}) 
TIY33DateתΪַ() ȡȡ Date תΪַ


÷
toString() ɰ Date תΪַؽ
﷨
dateObject.toString()
ֵ
dateObject ַʾʹñʱʾ
ʵ
ڱУǽѽתΪַ
<script type="text/javascript">

var d = new Date()
document.write (d.toString())

</script>

Thu Nov 21 2013 14:33:10 GMT+0800 (China Standard Time)
TIY
toString()
ʹ toString() ѽתΪַ
JavaScript Date οֲ

йת֪ʶĶ JavaScript ߼̳еݣ
ECMAScript ת
ڽ ECMAScript ṩתԼνǿת33ʱ䲿ֻΪַ()   ʱ䴮ʱ䴮 Date ʱ䲿תΪַ


÷
toTimeString() ɰ Date ʱ䲿תΪַؽ
﷨
dateObject.toTimeString()
ֵ
dateObject ʱ䲿ֵַʾʵ־ʹñʱʾ33ڲֻΪַ()   ڱ䴮ڱ䴮 Date ڲתΪַ


÷
toDateString() ɰ Date ڲתΪַؽ
﷨
dateObject.toDateString()
ֵ
dateObject ڲֵַʾʵ־ʹñʱʾ33ݸ(GMT)Ϊַ() α䴮α䴮ʹ toUTCString() 档


÷
toGMTString() ɸݸʱ (GMT)  Date תΪַؽ
﷨
dateObject.toGMTString()
ֵ
dateObject ַʾڻתΪַ֮ǰɱʱתΪ GMT ʱ
ʾע
޳ʹô˷ʹ toUTCString() ȡ֮
ʵ
 1
ڱУǽѽתΪ GMTַ
<script type="text/javascript">

var d = new Date()
document.write (d.toGMTString())

</script>

Thu, 21 Nov 2013 06:37:02 GMT
 2
УǽѾתΪ GMTַ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.toGMTString())

</script>

Wed, 20 Jul 1983 17:15:00 GMT
TIY
toGMTString()
ͨ toGMTString() ѽתΪ GMTַ33ʱתΪַ() 䴮䴮ʱ Date תΪַ


÷
toUTCString() ɸʱ (UTC)  Date תΪַؽ
﷨
dateObject.toUTCString()
ֵ
dateObject ַʾʱʾ
ʵ
 1
Уǽʹ toUTCString() ѽתΪ UTCַ
<script type="text/javascript">

var d = new Date()
document.write (d.toUTCString())

</script>

Thu, 21 Nov 2013 06:55:15 GMT
 2
УǽѾתΪ UTCַ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.toUTCString())

</script>

Wed, 20 Jul 1983 17:15:00 GMT
TIY
toUTCString()
ʹ toUTCString() ѽתΪ UTCַ33ݱʱʽַ() ر䴮ر䴮ݱʱʽ Date תΪַ



÷
toLocaleString() ɸݱʱ Date תΪַؽ
﷨
dateObject.toLocaleString()
ֵ
dateObject ַʾԱʱʾݱعʽ
ʵ
 1
ڱУǽݱʱѽתΪַ
<script type="text/javascript">

var d = new Date()
document.write(d.toLocaleString())

</script>

Thu Nov 21 2013 14:56:46 GMT+0800 (China Standard Time)
 2
ڱУǽݱʱѾתΪַ
<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.toLocaleString())

</script>

Thu Jul 21 1983 01:15:00 GMT+0800 (China Standard Time)
TIY
toLocaleString()
ʹ toLocaleString() ݱʱѽתΪַ33ݱظʽʱ任ִ() ʱ䴮ʱ䴮ݱʱʽ Date ʱ䲿תΪַ


÷
toLocaleTimeString() ɸݱʱ Date ʱ䲿תΪַؽ
﷨
dateObject.toLocaleTimeString()
ֵ
dateObject ʱ䲿ֵַʾԱʱʾݱعʽ
JavaScript Date οֲ33ݱظʽڻִ()   ڱ䴮ڱ䴮ݱʱʽ Date ڲתΪַ


÷
toLocaleDateString() ɸݱʱ Date ڲתΪַؽ
﷨
dateObject.toLocaleDateString()
ֵ
dateObject ڲֵַʾԱʱʾݱعʽ33ȡ1970/1/1()   ںںʱ 1970  1  1  ָڵĺ



÷
UTC() ɸʱ 1970  1  1  ָڵĺ
﷨
Date.UTC(year,month,day,hours,minutes,seconds,ms)
	
year	衣ʾݵλ֡
month	衣ʾ·ݵ 0 ~ 11
day	衣ʾڵ 1 ~ 31
hours	ѡʾСʱ 0 ~ 23
minutes	ѡʾӵ 0 ~ 59
seconds	ѡʾ 0 ~ 59
ms	ѡʾ 0 ~ 999
ֵ
ָʱ GMT ʱ 1970  1  1 ҹĺ
˵
Date.UTC() һ־̬ΪҪʹù캯 Date() ͨĳ Date á
Date.UTC() Ĳָںʱ䣬Ƕ UTC ʱ䣬 GMT ʱָ UTC ʱ佫תɺʽ캯 Date() ͷ Date.setTime() Ϳʹˡ
ʵ
 1
ڱУǽʱȡô 1970/01/01  2005/07/08 ĺ
<script type="text/javascript">

var d = Date.UTC(2005,7,8)
document.write(d)

</script>

1123459200000
 2
ڣǽӣʹתΪ꣺
<script type="text/javascript">

var minutes = 1000 * 60
var hours = minutes * 60
var days = hours * 24
var years = days * 365
var t = Date.UTC(2005,7,8)
var y = t/years
document.write("It's been: " + y + " years from 1970/01/01")
document.write(" to 2005/07/08!")

</script>

It's been: 35.62465753424657 years from 1970/01/01 to 2005/07/08!
TIY
UTC()
ʹ UTC()  1970/01/01 ڵĺʱ33 Date ԭʼֵ() ȡԭֵȡԭֵ Date ԭʼֵ


÷
valueOf()  Date ԭʼֵ
ԭʼֵ Date ж̳С
valueOf() ͨ JavaScript ں̨ԶãʽسڴС
ֵ
date ĺʾֵͷ Date.getTime صֵȡ8ѧѧMath 
Math ִѧ
ʹ Math Ժͷ﷨
var pi_value=Math.PI;
var sqrt_value=Math.sqrt(15);
עͣMath 󲢲 Date  String Ƕ࣬ûй캯 Math() Math.sin() ĺֻǺĳķ贴ͨ Math ΪʹþͿԵԺͷ83eȻԼ2.718      EE eȻĵԼ2.718



÷
Math.E Դ eȻĵֵ 2.71828
﷨
Math.E
ʵ
 Euler 
<script type="text/javascript">

document.write("Euler's number: " + Math.E);

</script>

Euler's number: 2.718281828459045
TIY83 2 ȻԼ0.693            LN2LN2 2 ȻԼ0.693


÷
LN2 Ծ loge2 2 Ȼֵ 0.69314718055994528623
﷨
Math.LN2
ʵ
 2 Ȼ
<script type="text/javascript">

document.write("LN2: " + Math.LN2);

</script>

LN2: 0.693147180559945383 10 ȻԼ2.302           LN10LN10 10 ȻԼ2.302



÷
LN2 Ծ loge2 2 Ȼֵ 0.69314718055994528623
﷨
Math.LN2
ʵ
 2 Ȼ
<script type="text/javascript">

document.write("LN2: " + Math.LN2);

</script>

LN2: 0.6931471805599453
TIY83 2 Ϊ׵ e ĶԼ 1.414    LOG2ELOG2E 2 Ϊ׵ e ĶԼ 1.414



÷
LOG2E Ծ log2e 2 Ϊ e Ķֵ 1.442695040888963387
﷨
Math.LOG2E
ʵ
 2 Ϊ e Ķ
<script type="text/javascript">

document.write("LOG2E: " + Math.LOG2E);

</script>

LOG2E: 1.442695040888963483 10 Ϊ׵ e ĶԼ0.434    LOG10ELOG10E 10 Ϊ׵ e ĶԼ0.434



÷
LOG10E Ծ log10e 10 Ϊ e Ķֵ 0.43429448190325181667
﷨
Math.LOG10E
ʵ
 10 Ϊ e Ķ
<script type="text/javascript">

document.write("LOG10E: " + Math.LOG10E);

</script>

LOG10E: 0.434294481903251883ԲʣԼ3.14159                 PIPIԲʣԼ3.14159



÷
PI Ծ УԲֱ֮ܳȡֵΪ 3.141592653589793
﷨
Math.PI
ʵ
 PI
<script type="text/javascript">

document.write("PI: " + Math.PI);

</script>

PI: 3.141592653589793832ƽĵԼ 0.707         SQRT1_2SQRT1_2 2 ƽĵԼ 0.707





÷
SQRT1_2 Է 2 ƽĵֵΪ 0.7071067811865476
﷨
Math.SQRT1_2
ʵ
 1/2 ƽ
<script type="text/javascript">

document.write("SQRT1_2: " + Math.SQRT1_2);

</script>

SQRT1_2: 0.707106781186547683 2 ƽԼ 1.414             SQRT2SQRT2 2 ƽԼ 1.414




÷
SQRT2 Է 2 ƽֵΪ 1.4142135623730951
﷨
Math.SQRT2
ʵ
 2 ƽ
<script type="text/javascript">

document.write("SQRT2: " + Math.SQRT2);

</script>

SQRT2: 1.414213562373095183ľֵ()                          ֵֵľֵ



÷
abs() ɷľֵ
﷨
Math.abs(x)
	
x	衣һֵ
ֵ
x ľֵ
ʵ
ڱУҽȡ͸ľֵ
<script type="text/javascript">

document.write(Math.abs(7.25) + "<br />")
document.write(Math.abs(-7.25) + "<br />")
document.write(Math.abs(7.25-10))

</script>

7.25
7.25
2.75
TIY
abs()
ʹ abs() ȡľֵ83ķֵ()                        ҡҡķֵ



÷
acos() ɷһķҡ
﷨
Math.acos(x)
	
x	衣 -1.0 ~ 1.0 ֮
ֵ
x ķֵصֵ 0  PI ֮Ļֵ
ʾע
עͣ x  -1.0 ~ 1.0 ķΧô NaN
עͣ x ȡֵ -1ô PI
ʵ
ڱУǽȡòͬķֵ
<script type="text/javascript">

document.write(Math.acos(0.64) + "<br />")
document.write(Math.acos(0) + "<br />")
document.write(Math.acos(-1) + "<br />")
document.write(Math.acos(1) + "<br />")
document.write(Math.acos(2))

</script>

0.8762980611683406
1.5707963267948965
3.141592653589793
0
NaN 
TIY
acos()
ʹ acos() ȡòͬķֵ83ķֵ()                        ҡҡķֵ



÷
asin() ɷһķֵ
﷨
Math.asin(x)
	
x	衣һֵֵ -1.0 ~ 1.0 ֮䡣
ֵ
x ķֵصֵ -PI/2  PI/2 ֮Ļֵ
ʾע
עͣ x  -1.0 ~ 1.0 ķΧô NaN
עͣ x ȡֵ 1ô PI/2
ʵ
ڱУǽȡòֵͬķֵ
<script type="text/javascript">

document.write(Math.asin(0.64) + "<br />")
document.write(Math.asin(0) + "<br />")
document.write(Math.asin(-1) + "<br />")
document.write(Math.asin(1) + "<br />")
document.write(Math.asin(2))

</script>

0.6944982656265559
0
-1.5707963267948965
1.5707963267948965
NaN
TIY
asin()
ʹ asin() ȡòֵͬķֵ83Խ-PI/2 PI/2xķֵ() ССԽ -PI/2  PI/2 ֵ֮ x ķֵ


÷
atan() ɷֵķֵ
﷨
Math.atan(x)
	
x	衣һֵ
ֵ
x ķֵصֵ -PI/2  PI/2 ֮Ļֵ
ʵ
ӿͨ atan() زֵͬķֵ
<script type="text/javascript">

document.write(Math.atan(0.50) + "<br />")
document.write(Math.atan(-0.50) + "<br />")
document.write(Math.atan(5) + "<br />")
document.write(Math.atan(10) + "<br />")
document.write(Math.atan(-5) + "<br />")
document.write(Math.atan(-10))

</script>

0.4636476090008061
-0.4636476090008061
1.373400766945016
1.4711276743037347
-1.373400766945016
-1.4711276743037347
TIY
atan()
ʹ atan() زֵͬķֵ
JavaScript Math οֲ83ȡxᵽ(x,y)Ƕ:-PI/2PI/2֮()  ǶȡǶȡش x ᵽ (x,y) ĽǶȣ -PI/2  PI/2 ֮䣩


÷
atan2() ɷش x ᵽ (x,y) ֮ĽǶȡ
﷨
Math.atan2(y,x)
	
x	衣ָ X ꡣ
y	衣ָ Y ꡣ
ֵ
-PI  PI ֵ֮Ǵ X ʱת (x,y) ʱĽǶȡ
ʾע
עͣעĲ˳Y  X ֮ǰݡ
ʵ
ӿͨ atan2() زͬ (x,y) ĽǶȣ
<script type="text/javascript">

document.write(Math.atan2(0.50,0.50) + "<br />")
document.write(Math.atan2(-0.50,-0.50) + "<br />")
document.write(Math.atan2(5,5) + "<br />")
document.write(Math.atan2(10,20) + "<br />")
document.write(Math.atan2(-5,-5) + "<br />")
document.write(Math.atan2(-10,10))

</script>

0.7853981633974483
-2.356194490192345
0.7853981633974483
0.4636476090008061
-2.356194490192345
-0.7853981633974483 
TIY
atan2()
ʹ atan2() زͬ (x,y) ĽǶȡ83()                          ȡȡ롣



÷
ceil() ɶһ롣
﷨
Math.ceil(x)
	
x	衣һֵ
ֵ
ڵ xӽ
˵
ceil() ִеȡ㣬صǴڻں֮ӽ
ʵ
ڱУǽ ceil() õͬϣ
<script type="text/javascript">

document.write(Math.ceil(0.60) + "<br />")
document.write(Math.ceil(0.40) + "<br />")
document.write(Math.ceil(5) + "<br />")
document.write(Math.ceil(5.1) + "<br />")
document.write(Math.ceil(-5.1) + "<br />")
document.write(Math.ceil(-5.9))

</script>

1
1
5
6
-5
-5
TIY
ceil()
ʹ ceil() 83()                            ҡҡҡ



÷
cos() ɷһֵֵ
﷨
Math.cos(x)
	
x	衣һֵ
ֵ
x ֵص -1.0  1.0 ֮
ʵ
ڱУǽزֵֵͬ
<script type="text/javascript">

document.write(Math.cos(3) + "<br />")
document.write(Math.cos(-3) + "<br />")
document.write(Math.cos(0) + "<br />")
document.write(Math.cos(Math.PI) + "<br />")
document.write(Math.cos(2*Math.PI))

</script>

-0.9899924966004454
-0.9899924966004454
1
-1
1
TIY
cos()
ʹ cos() ȡһЩֵֵ83 e ָ()                           eָeָ e ָ



÷
exp() ɷ e  x ݵֵ
﷨
Math.exp(x)
	
x	衣ֵʽָ
ֵ
 e  x ݡe ȻĵֵΪ 2.71828
ʵ
Уǽ exp() õֵͬϣ
<script type="text/javascript">

document.write(Math.exp(1) + "<br />")
document.write(Math.exp(-1) + "<br />")
document.write(Math.exp(5) + "<br />")
document.write(Math.exp(10) + "<br />")

</script>

2.718281828459045
0.36787944117144233
148.4131591025766
22026.465794806718
TIY
exp()
ʹ exp() 83()                          ȡȡ롣



÷
floor() ɶһ롣
﷨
Math.floor(x)
	
x	衣ֵʽ
ֵ
Сڵ x x ӽ
˵
floor() ִеȡ㣬صСڻں֮ӽ
ʵ
In this example we will use the floor() method on different numbers:
<script type="text/javascript">

document.write(Math.floor(0.60) + "<br />")
document.write(Math.floor(0.40) + "<br />")
document.write(Math.floor(5) + "<br />")
document.write(Math.floor(5.1) + "<br />")
document.write(Math.floor(-5.1) + "<br />")
document.write(Math.floor(-5.9))

</script>

0
0
5
5
-6
-6
TIY
floor()
ʹ floor() 83ȻΪe()                 ȻΪe



÷
log() ɷһȻ
﷨
Math.log(x)
	
x	衣ֵʽ
ֵ
x Ȼ
˵
 x  0
ʵ
ڱУǽԲͬ log() 
<script type="text/javascript">

document.write(Math.log(2.7183) + "<br />")
document.write(Math.log(2) + "<br />")
document.write(Math.log(1) + "<br />")
document.write(Math.log(0) + "<br />")
document.write(Math.log(-1))

</script>

1.0000066849139877
0.6931471805599453
0
-Infinity
NaN
TIY
log()
ʹ log 83 x  y еֵ()                  ȡȡ x  y еֵ



max() ɷָднϴֵǸ
﷨
Math.max(x...)
	
x	0 ֵ ECMASCript v3 ֮ǰ÷ֻ
ֵ
ֵûв򷵻 -InfinityĳΪ NaNǲתֵķֵ򷵻 NaN
ʵ
ڱУǽչʾʹ max() ָдֵ֣
<script type="text/javascript">

document.write(Math.max(5,7) + "<br />")
document.write(Math.max(-3,5) + "<br />")
document.write(Math.max(-3,-5) + "<br />")
document.write(Math.max(7.25,7.30))

</script>

7
5
-3
7.3
TIY
max()
ʹ max() ָдֵ֡83 x  y еֵ()                  ȡСȡС x  y еֵ


÷
min() ɷָдֵ֡
﷨
Math.min(x,y)
	
x	0 ֵ ECMASCript v3 ֮ǰ÷ֻ
ֵ
Сֵûв򷵻 InfinityĳΪ NaNǲתֵķֵ򷵻 NaN
ʵ
ڱУǽչʾʹ min() ָдֵ֣
<script type="text/javascript">

document.write(Math.min(5,7) + "<br />")
document.write(Math.min(-3,5) + "<br />")
document.write(Math.min(-3,-5) + "<br />")
document.write(Math.min(7.25,7.30))

</script>

5
-3
-5
7.25
TIY
min()
ʹ min() ȡָдֵ֡83 x  y ()                        ݡݡ x  y ݡ


÷
pow() ɷ x  y ݵֵ
﷨
Math.pow(x,y)
	
x	衣֡
y	衣֡
ֵ
x  y ݡ
˵
÷ NaNָ𸡵÷ Infinity
ʵ
Уǽ pow() õͬϣ
<script type="text/javascript">

document.write(Math.pow(0,0) + "<br />")
document.write(Math.pow(0,1) + "<br />")
document.write(Math.pow(1,1) + "<br />")
document.write(Math.pow(1,10) + "<br />")
document.write(Math.pow(2,3) + "<br />")
document.write(Math.pow(-2,3) + "<br />")
document.write(Math.pow(2,4) + "<br />")
document.write(Math.pow(-2,4) + "<br />")

</script>

1
0
1
1
8
-8
16
16
TIY
pow()
ʹ pow() 83 0 ~ 1 ֮()                  0 ~ 1 ֮



÷
random() ɷؽ 0 ~ 1 ֮һ
﷨
Math.random()
ֵ
0.0 ~ 1.0 ֮һα
ʵ
ڱУǽȡý 0  1 ֮һ
<script type="text/javascript">

document.write(Math.random())

</script>

0.3166404312942177
TIY
random()
ʹ random() ȡһ83Ϊӽ()              Ϊӽ



÷
round() ɰһΪӽ
﷨
Math.round(x)
	
x	衣֡
ֵ
 x ӽ
˵
 0.5÷롣
磬3.5 Ϊ 4 -3.5 Ϊ -3
ʵ
ѲͬΪӽ
<script type="text/javascript">

document.write(Math.round(0.60) + "<br />")
document.write(Math.round(0.50) + "<br />")
document.write(Math.round(0.49) + "<br />")
document.write(Math.round(-4.40) + "<br />")
document.write(Math.round(-4.60))

</script>

1
1
0
-4
-5
TIY
round()
ʹ round() 83()                            ҡҡҡ


÷
sin() ɷһֵҡ
﷨
Math.sin(x)
	
x	衣һԻȱʾĽǡǶȳ 0.017453293 2PI/360תΪȡ
ֵ
 x ֵֵ -1.0  1.0 ֮䡣
ʵ
ڱУǽزֵͬң
<script type="text/javascript">

document.write(Math.sin(3) + "<br />")
document.write(Math.sin(-3) + "<br />")
document.write(Math.sin(0) + "<br />")
document.write(Math.sin(Math.PI) + "<br />")
document.write(Math.sin(Math.PI/2)

</script>

0.1411200080598672
-0.1411200080598672
0
1.2246063538223772e-16
1
TIY
sin()
ʹ sin() ȡһЩֵҡ83ƽ()                          ƽƽƽ




÷
sqrt() ɷһƽ
﷨
Math.sqrt(x)
	
x	衣Ǵڵ 0 
ֵ
 x ƽ x С 0򷵻 NaN
ʾע
ʾMath.pow() Լһθ
ʵ
ڱУǽزֵͬƽ
var a=Math.sqrt(0);
var b=Math.sqrt(1);
var c=Math.sqrt(9);
var d=Math.sqrt(0.64);
var e=Math.sqrt(-9);

0
1
3
0.8
NaN
һԡ83ؽǵ()                            ССؽǵС



÷
tan() ɷһʾĳǵе֡
﷨
Math.tan(x)
	
x	衣һԻȱʾĽǡǶȳ 0.017453293 2PI/360תΪȡ
ֵ
 x ֵ
ʵ
ڱУǽ㲻ֵֵͬ
<script type="text/javascript">

document.write(Math.tan(0.50) + "<br />")
document.write(Math.tan(-0.50) + "<br />")
document.write(Math.tan(5) + "<br />")
document.write(Math.tan(10) + "<br />")
document.write(Math.tan(-5) + "<br />")
document.write(Math.tan(-10))

</script>

0.5463024898437905
-0.5463024898437905
-3.380515006246586
0.6483608274590866
3.380515006246586
-0.6483608274590866
TIY
tan()
ʹ tan() 㲻ֵֵͬ83ظöԴ()                      ԴԴظöԴ롣



÷
toSource() رʾԴַ
﷨
object.toSource()
ʾע
עͣ÷ Internet Explorer Ч
ʵ
չʾ toSource() ÷
<script type="text/javascript">

function employee(name,job,born)
{
this.name=name;
this.job=job;
this.born=born;
}

var bill=new employee("Bill Gates","Engineer",1985);

document.write(bill.toSource());

</script>

({name:"Bill Gates", job:"Engineer", born:1985}) 
TIY83 Math ԭʼֵ()                  ȡԭֵȡԭֵ Math ԭʼֵ




÷
valueOf()  Math ԭʼֵ
ԭʼֵ Math ж̳С
valueOf() ͨ JavaScript ں̨ԶãʽسڴС
﷨
mathObject.valueOf()8ֵֵNumber 
Number ԭʼֵİװ
 Number ﷨
var myNum=new Number(value);
var myNum=Number(value);

 value Ҫ Number ֵҪתֵֵ
ֵ
 Number()  new һΪ캯ʹʱһ´ Number  new  Number() ΪһãԼĲתһԭʼֵҷֵתʧܣ򷵻 NaN112ضԴ˶ Number    캯캯ضԴ˶ Number á







÷
constructor ԷضԴ˶ Boolean á
﷨
object.constructor
ʵ
ڱУǽչʾʹ constructor ԣ
<script type="text/javascript">

var test=new Boolean();

if (test.constructor==Array)
{
document.write("This is an Array");
}
if (test.constructor==Boolean)
{
document.write("This is a Boolean");
}
if (test.constructor==Date)
{
document.write("This is a Date");
}
if (test.constructor==String)
{
document.write("This is a String");
}

</script>

This is a Boolean
TIY
TIY
constructor
ڱУǽչʾʹ constructor ԡ112ɱʾ                       ɱʾ



÷
MAX_VALUE  JavaScript пɱʾĽֵΪ 1.7976931348623157 x 10308
﷨
Number.MAX_VALUE
ʵ
 JavaScript пֵܵ
<script type="text/javascript">

document.write(Number.MAX_VALUE);

</script>

1.7976931348623157e+308
TIY
TIY
MAX_VALUE
 JavaScript 112ɱʾС                       ССɱʾС




÷
MIN_VALUE  JavaScript пɱʾСӽ 0 ǸĽֵΪ 5 x 10-324
﷨
Number.MIN_VALUE
ʵ
 JavaScript пܵСֵ
<script type="text/javascript">

document.write(Number.MIN_VALUE);

</script>

5e-324
TIY
TIY
MIN_VALUE
 JavaScript С112ֵ                               ֵ


÷
NaN Ǵֵֵָʾĳֵ֡԰ Number Ϊֵָʾ䲻ֵ
ʾʹ isNaN() ȫֺжһֵǷ NaN ֵ
﷨
Number.NaN
˵
Number.NaN һֵ˵ĳЩ㣨ƽĽ֡ parseInt()  parseFloat() ڲַָܽʱͷֵһЩ·ЧֵĺҲԲַ Number.NaN ˵Ĵ
JavaScript  NaN ʽ Number.NaNע⣬NaN ֵбȽϵĽǲȵģڡˣ Number.NaN Ƚһֵǲֻ֣ܵ isNaN() Ƚϡ
 ECMAScript v1 İ汾УԤȫ NaN  Number.NaN
ʾע
ʾʹ isNaN() жһֵǷ֡ԭ NaN ֵȣԼ
ʵ
 NaN ָʾĳֵǷ֣
<script type="text/javascript">

var Month=30;

if (Month < 1 || Month > 12)
{
Month = Number.NaN;
}

document.write(Month);

</script>

Nan
TIY
TIY
NaN
ͨ NaN жһֵ
ҳ
JavaScript ȫֶοֲ᣺NaN 
JavaScript ȫֶοֲ᣺isNaN() 112ʱظֵ               ʱظֵ



÷
NEGATIVE_INFINITY ԱʾС Number.MIN_VALUE ֵ
ֵ
﷨
Number.NEGATIVE_INFINITY
˵
Number.NEGATIVE_INFINITY һֵһ JavaScript ܱʾССҲǱ -Number.MAX_VALUE Сʱء
JavaScript ʾ NEGATIVE_INFINITY ʱʹõ -InfinityֵΪǳơ磬κΪκĽΪ 0
 ECMAScript v1 İ汾У -Infinity  Number.NEGATIVE_INFINITY
ʵ
ڱУǽʹ NEGATIVE_INFINITY
<script type="text/javascript">

var x=(-Number.MAX_VALUE)*2
if (x==Number.NEGATIVE_INFINITY)
  {
  document.write("Value of x: " + x);
  }

</script>

Value of x: -Infinity
TIY
TIY
NEGATIVE_INFINITY
ͨ NEGATIVE_INFINITY жһֵǷǸ
ҳ
JavaScript ȫֶοֲ᣺Infinity 
JavaScript ȫֶοֲ᣺isFinite() 112ʱظֵ               ʱظֵ




÷
POSITIVE_INFINITY Աʾ Number.MAX_VALUE ֵ
ֵ
﷨
Number.POSITIVE_INFINITY
˵
Number.POSITIVE_INFINITY һֵһ JavaScript ܱʾҲǱ Number.MAX_VALUE ʱء
JavaScript ʾ POSITIVE_INFINITY ʱʹõ InfinityֵΪǳơ磬κΪκĽΪ 0
 ECMAScript v1 İ汾У Infinity  Number.POSITIVE_INFINITY
ʵ
ڱУǽʹ POSITIVE_INFINITY
<script type="text/javascript">

var x=(Number.MAX_VALUE)*2
if (x==Number.POSITIVE_INFINITY)
  {
  document.write("Value of x: " + x);
  }

</script>

Value of x: Infinity
TIY
TIY
POSITIVE_INFINITY
ͨ POSITIVE_INFINITY жһֵǷ
ҳ
JavaScript ȫֶοֲ᣺Infinity 
JavaScript ȫֶοֲ᣺isFinite() 112ʹԺͷ         ӡӡʹԺͷ


112תΪַʹָĻ()   ȡȡתΪַʹָĻ


÷
toString() ɰһ Number תΪһַؽ
﷨
NumberObject.toString(radix)
	
radix	ѡ涨ʾֵĻʹ 2 ~ 36 ֮ʡԸòʹû 10Ҫע⣬ò 10 ֵ ECMAScript ׼ʵֵַ
ֵ
ֵַʾ磬 radix Ϊ 2 ʱNumberObject ᱻתΪֵʾַ
׳
ø÷Ķ Number ʱ׳ TypeError 쳣
ʵ
ڱУǽһתΪַ
<script type="text/javascript">

var number = new Number(1337);
document.write (number.toString())

</script>

1337
TIY
toString()
ʹ toString() תΪַ
JavaScript Number οֲ

йת֪ʶĶ JavaScript ߼̳еݣ112תַʹñָʽ˳() ر䴮ر䴮תΪַʹñָʽ˳



÷
toLocaleString() ɰһ Number תΪظʽַ
﷨
NumberObject.toLocaleString()
ֵ
ֵַʾʵ־ݱع淶иʽӰ쵽Сǧλָõıš
׳
ø÷Ķ Number ʱ׳ TypeError 쳣112תַ,Сָλ()        ֱ䴮ֱ䴮תΪַСָλ֡



÷
toFixed() ɰ Number ΪָСλ֡
﷨
NumberObject.toFixed(num)
	
num	衣涨Сλ 0 ~ 20 ֵ֮ 0  20Щʵֵָֿ֧Χʡ˸ò 0 档
ֵ
 NumberObject ַʾָСй̶ num λ֡Ҫֻᱻ룬Ҳ 0 㣬Աﵽָĳȡ num  le+21÷ֻ NumberObject.toString()زָʾַ
׳
 num ̫С̫ʱ׳쳣 RangeError0 ~ 20 ֵ֮쳣Щʵָ֧ΧСΧڵֵ
ø÷Ķ Number ʱ׳ TypeError 쳣
ʵ
ڱУǽΪһλС֣
Show the number 13.37 with one decimal:
<script type="text/javascript">
var num = new Number(13.37);
document.write (num.toFixed(1))
</script>

Show the number 13.37 with one decimal:
13.4
TIY
toFixed()
ʹ toFixed() һ֡112ѶֵתΪָ()           ָָѶֵתΪָ




÷
toExponential() ɰѶֵתָ
﷨
NumberObject.toExponential(num)
	
num	衣涨ָеСλ 0 ~ 20 ֵ֮ 0  20Щʵֵָֿ֧Χʡ˸òʹþܶ֡
ֵ
 NumberObject ַʾָС֮ǰһλ֣С֮ num λֵ֡Сֽ룬Ҫʱ 0 㣬Աﵽָĳȡ
׳
 num ̫С̫ʱ׳쳣 RangeError0 ~ 20 ֵ֮쳣Щʵָ֧ΧСΧڵֵ
ø÷Ķ Number ʱ׳ TypeError 쳣
ʵ
ڱУǽһתΪָ
Show 10,000 as an exponential notation:
<script type="text/javascript">
var num = new Number(10000);
document.write (num.toExponential(1))
</script>

Show 10,000 as an exponential notation:
1.0e+4
TIY
toExponential()
ʹ toExponential() תΪָ112ָʽΪָĳ()             ʽȡʽȡָʽΪָĳȡ



÷
toPrecision() ڶֵָλʱתΪָ
﷨
NumberObject.toPrecision(num)
	
num	衣涨뱻תΪָСλò 1 ~ 21 ֮䣨Ұ 1  21ֵЧʵѡָ֧С numʡ˸ò÷ toString()ǰתʮƵֵ
ֵ
 NumberObject ַʾ num Ч֡ num 㹻ܹ NumberObject ֵ֣ôصַö򣬲ָСǰһλ֣С num-1 λ֡Ҫʱֻᱻ 0 㡣
׳
 num ̫С̫ʱ׳쳣 RangeError1 ~ 21 ֵ֮쳣Щʵָ֧ΧСΧڵֵ
ø÷Ķ Number ʱ׳ TypeError 쳣
ʵ
ڱУǽһתΪָ
Show 10,000 as an exponential notation:
<script type="text/javascript">
var num = new Number(10000);
document.write (num.toPrecision(4))
</script>

Show 10,000 as an exponential notation:
1.000e+4
TIY
toPrecision()
ʹ toPrecision() תΪָ112һ Number Ļֵ()     ȡԭֵȡԭֵһ Number Ļֵ




÷
valueOf() ַ֡
ַͨڸ֡
valueOf() ͨ JavaScript ں̨ԶеãʽشڴС
﷨
NumberObject.valueOf()
ֵ
NumberObject ԭʼֵ
׳
ø÷Ķ Number ʱ׳ TypeError 쳣8ıַַString 
String ڴıַ
 String ﷨
new String(s);
String(s);

 s Ҫ洢 String лתԭʼֵַ
ֵ
 String()  new һΪ캯ʹʱһ´ String 󣬴ŵַ s  s ַʾ
 new  String() ʱֻ s תԭʼַתֵ
126Դöĺ              캯캯Դöĺá126ַĳ                          ȡȡַĳ



length ԿɷַеַĿ
﷨
stringObject.length
ʵ
ڱУǽչʾʹ length ַеַ
<script type="text/javascript">

var txt="Hello World!"
document.write(txt.length)

</script>

12
TIY
length
ڱУǽչʾʹ length ԡ126Ժͷ            ӡӡԺͷ126 HTML ê()                        êê HTML ê



÷
anchor() ڴ HTML ê
stringObject.anchor(anchorname)
	
anchorname	衣Ϊêơ
ʵ
ڱУǻΪıһê
<script type="text/javascript">

var txt="Hello world!"
document.write(txt.anchor("myanchor"))

</script>
Ĵ뽫Ϊ HTML
<a name="myanchor">Hello world!</a>126ôʾַ()                ššôʾַ



÷
big() ڰַʾΪ塣
stringObject.big()
ʵ
ڱУ"Hello world!" ʾΪ壺
<script type="text/javascript">

var str="Hello world!"
document.write(str.big())

</script>
TIY
big()
ʹ big() ַʾΪ塣126ʾַ()                      ʾַ



÷
blink() ʾַ
﷨
stringObject.blink()
ʾע
עͣ˷޷ Internet Explorer С
ʵ
ڱУ"Hello world!" ʾΪı
<script type="text/javascript">

var str="Hello world!"
document.write(str.blink())

</script>
TIY
blink()
ʹ blink() ʾı126ʹôʾַ()                  ʹôʾַ



÷
bold() ڰַʾΪ塣
﷨
stringObject.bold()
ʵ
ڱУ"Hello world!" ʾΪ壺
<script type="text/javascript">

var str="Hello world!"
document.write(str.bold())

</script>
TIY
bold()
ʹ bold() ַʾΪ塣126ָλõַ()                λáλáָλõַ



÷
charAt() ɷָλõַ
ע⣬JavaScript ûһбַ͵ַͣԷصַǳΪ 1 ַ
﷨
stringObject.charAt(index)
	
index	衣ʾַĳλõַַ֣е±ꡣ
ʾע
עַͣеһַ± 0 index  0  string.length ֮䣬÷һַ
ʵ
ַ "Hello world!" Уǽλ 1 ַ
<script type="text/javascript">

var str="Hello world!"
document.write(str.charAt(1))

</script>
ϴǣ
e
TIY
charAt()
ʹ charAt() ĳַȡþַ126ָλõַUnicode()   ַַָλõַ Unicode 롣


÷
charCodeAt() ɷָλõַ Unicode 롣ֵ 0 - 65535 ֮
 charCodeAt()  charAt() ִеĲƣֻǰ߷صλָλõַı룬߷صַӴ
﷨
stringObject.charCodeAt(index)
	
index	衣ʾַĳλõַַ֣е±ꡣ
ʾע
עַͣеһַ± 0 index Ǹڵַĳȣ charCodeAt()  NaN
ʵ
ַ "Hello world!" Уǽλ 1 ַ Unicode 룺
<script type="text/javascript">

var str="Hello world!"
document.write(str.charCodeAt(1))

</script>
ϴǣ
101
TIY
charCodeAt()
ʹ charCodeAt() ַĳַ Unicode 롣126ַ()                          ӡӡַ



÷
concat() ַ
﷨
stringObject.concat(stringX,stringX,...,stringX)
	
stringX	衣Ϊһַһַ
concat() вתַȻ˳ӵַ stringObject βӺַע⣬stringObject ûбġ
stringObject.concat()  Array.concat() ơ
ʾע
ʾע⣬ʹ " + " ַͨһЩ
ʵ
ڱУǽַȻʹ concat() ʾΪһַ
<script type="text/javascript">

var str1="Hello "
var str2="world!"
document.write(str1.concat(str2))

</script>
ϴǣ
Hello world!
TIY
concat()
ʹ concat() ַ126Դֻıʾַ()              ֡֡Դֻıʾַ


÷
fixed() ڰַʾΪֻ塣
﷨
stringObject.fixed()
ʵ
ڱУ"Hello world!" ʾΪֻı
<script type="text/javascript">

var str="Hello world!"
document.write(str.fixed())

</script>
TIY
fixed()
ʹ fixed() ַʾΪֻ塣126ʹָɫʾַ()          ɫɫʹָɫʾַ



÷
fontcolor() ڰָɫʾַ
﷨
stringObject.fontcolor(color)
	
color	衣Ϊַ涨 font-colorֵɫ(red)RGB ֵ(rgb(255,0,0))ʮ(#FF0000)
ʵ
ڱУ"Hello world!" ʾΪɫ
<script type="text/javascript">

var str="Hello world!"
document.write(str.fontcolor("Red"))

</script>
TIY
fontcolor()
ʹ fontcolor() ַʾΪɫ126ʹָĳߴʾַ()          ֵֵʹָĳߴʾַ



÷
fontsize() ڰָĳߴʾַ
﷨
stringObject.fontsize(size)
ʾע
עͣsize Ǵ 1  7 ֡
ʵ
ڱУ"Hello world!" ʾΪ֣
<script type="text/javascript">

var str="Hello world!"
document.write(str.fontsize(7))

</script>
TIY
fontsize()
ʹ fontsize() ַʾΪ֡126ַ봴һַ()            봮봮ַ봴һַ




÷
fromCharCode() ɽһָ Unicode ֵȻ󷵻һַ
﷨
String.fromCharCode(numX,numX,...,numX)
	
numX	衣һ Unicode ֵҪַеַ Unicode 롣
ʾע
עͣ÷ String ľַ̬еÿַɵ Unicode ָ
ΪѴ String ķʹá﷨Ӧ String.fromCharCode() myStringObject.fromCharCode()
ʵ
ڱУǽ Unicode  "HELLO"  "ABC"
<script type="text/javascript">

document.write(String.fromCharCode(72,69,76,76,79))
document.write("<br />")
document.write(String.fromCharCode(65,66,67))

</script>
ϴ
HELLO
ABC
TIY
fromCharCode()
ʹ fromCharCode()  Unicode ֵʾַ

charCodeAt() 126ַ()                          ѰҡѰҡַ



÷
indexOf() ɷĳֵַַָ״γֵλá
﷨
stringObject.indexOf(searchvalue,fromindex)
	
searchvalue	衣涨ֵַ
fromindex	ѡ涨ַпʼλáĺϷȡֵ 0  stringObject.length - 1ʡԸò򽫴ַַʼ
˵
÷ͷβؼַ stringObjectǷӴ searchvalueʼλַ fromindex ַĿͷûָ fromindex ʱҵһ searchvalue򷵻 searchvalue ĵһγֵλástringObject еַλǴ 0 ʼġ
ʾע
עͣindexOf() ԴСдУ
עͣҪֵַûг֣÷ -1
ʵ
ڱУǽ "Hello world!" ַڽвͬļ
<script type="text/javascript">

var str="Hello world!"
document.write(str.indexOf("Hello") + "<br />")
document.write(str.indexOf("World") + "<br />")
document.write(str.indexOf("world"))

</script>
ϴ
0
-1
6
TIY
indexOf()
ʹ indexOf() ַڽм

charCodeAt() lastIndexOf() substring() 126ʹбʾַ()                  ббʹбʾַ


÷
italics() ڰַʾΪб塣
﷨
stringObject.italics()
ʵ
ڱУ"Hello world!" ʾΪб壺
<script type="text/javascript">

var str="Hello world!"
document.write(str.italics())

</script>
TIY
italics()
ʹ italics() ַʾΪб塣126Ӻǰַ()                  ҡҡӺǰַ



÷
lastIndexOf() ɷһֵֵַָλãһַеָλôӺǰ
﷨
stringObject.lastIndexOf(searchvalue,fromindex)
	
searchvalue	衣涨ֵַ
fromindex	ѡ涨ַпʼλáĺϷȡֵ 0  stringObject.length - 1ʡԸò򽫴ַһַʼ
ֵ
 stringObject е fromindex λ֮ǰ searchvalue򷵻صǳֵһ searchvalue λá
˵
÷βͷؼַ stringObjectǷӴ searchvalueʼλַ fromindex ַĽβûָ fromindex ʱҵһ searchvalue򷵻 searchvalue ĵһַ stringObject еλástringObject еַλǴ 0 ʼġ
ʾע
עͣlastIndexOf() ԴСдУ
עͣҪֵַûг֣÷ -1
ʵ
ڱУǽ "Hello world!" ַڽвͬļ
<script type="text/javascript">

var str="Hello world!"
document.write(str.lastIndexOf("Hello") + "<br />")
document.write(str.lastIndexOf("World") + "<br />")
document.write(str.lastIndexOf("world"))

</script>
ϴ
0
-1
6
TIY
lastIndexOf()
ʹ lastIndexOf() ַڽм

charCodeAt() indexOf() substring() 126ַʾΪ()                  ӡӡַʾΪӡ



÷
link() ڰַʾΪӡ
﷨
stringObject.link(url)
	
url	衣涨Ҫӵ URL
ʵ
ڱУ"Free Web Tutorials!" ʾΪӣ
<script type="text/javascript">

var str="Free Web Tutorials!"
document.write(str.link("http://www.w3school.com.cn"))

</script>
TIY
link()
ʹ link() ַʾΪӡ126ñض˳Ƚַ()    ȽϡȽϡñض˳Ƚַ


÷
ñض˳Ƚַ
﷨
stringObject.localeCompare(target)
	
target	ҪԱض˳ stringObject бȽϵַ
ֵ
˵ȽϽ֡ stringObject С target localeCompare() С 0  stringObject  target÷ش 0 ַȣݱû𣬸÷ 0
˵
 <  > Ӧõַʱַֻ Unicode Ƚַǵصַɵ˳һȷġ磬Уַ ch ͨΪĸ c  d ַ֮
localeCompare() ṩıȽַķĬϵıECMAscript ׼ûй涨νбضıȽϲֻ涨úõײϵͳṩ
ʵ
ڱУǽñضַ
var str;
str.sort (function(a,b){return a.localeCompare(b)})


126ҵһʽƥ()      ƥƥҵһʽƥ䡣




÷
match() ַڼֵָҵһʽƥ䡣
÷ indexOf()  lastIndexOf()ֵַָλá
﷨
stringObject.match(searchvalue)
stringObject.match(regexp)
	
searchvalue	衣涨Ҫֵַ
regexp	衣涨Ҫƥģʽ RegExp ò RegExp ҪȰݸ RegExp 캯תΪ RegExp 
ֵ
ƥ顣 regexp Ƿȫֱ־ g
˵
match() ַ stringObjectҵһ regexp ƥıΪں̶ܴ regexp Ƿб־ g
 regexp ûб־ gô match() ֻ stringObject ִһƥ䡣ûҵκƥı match()  nullһ飬дҵƥıйصϢĵ 0 ԪشŵƥıԪشŵʽӱʽƥıЩԪ֮⣬ص黹ԡindex ƥıʼַ stringObject еλãinput Ƕ stringObject á
 regexp б־ g match() ִȫּҵ stringObject еƥַûҵκƥӴ򷵻 nullҵһƥӴ򷵻һ顣ȫƥ䷵صǰߴͬԪдŵ stringObject еƥӴҲû index Ի input ԡ
ע⣺ȫּģʽ£match() ṩӱʽƥıϢҲÿƥӴλáҪЩȫּϢʹ RegExp.exec()
ʵ
 1
ڱУǽ "Hello world!" нвͬļ
<script type="text/javascript">

var str="Hello world!"
document.write(str.match("world") + "<br />")
document.write(str.match("World") + "<br />")
document.write(str.match("worlld") + "<br />")
document.write(str.match("world!"))

</script>

world
null
null
world!
 2
ڱУǽʹȫƥʽַе֣
<script type="text/javascript">

var str="1 plus 2 equal 3"
document.write(str.match(/\d+/g))

</script>

1,2,3
TIY
match() 1
ʹ match() һַ
match() 2
ʹ match() һʽƥ䡣126滻ʽƥӴ()          滻滻滻ʽƥӴ



÷
replace() ַһЩַ滻һЩַ滻һʽƥӴ
﷨
stringObject.replace(regexp/substr,replacement)
	
regexp/substr	
衣涨ַҪ滻ģʽ RegExp 
ע⣬ֵһַΪҪֱıģʽȱתΪ RegExp 
replacement	衣һֵַ涨滻ı滻ıĺ
ֵ
һµַ replacement 滻 regexp ĵһƥƥ֮õġ
˵
ַ stringObject  replace() ִеǲҲ滻Ĳ stringObject в regexp ƥַȻ replacement 滻ЩӴ regexp ȫֱ־ gô replace() 滻ƥӴֻ滻һƥӴ
replacement ַҲǺַôÿƥ䶼ַ滻 replacement е $ ַضĺ塣±ʾ˵ģʽƥõַ滻
ַ	滻ı
$1$2...$99	 regexp еĵ 1  99 ӱʽƥı
$&	 regexp ƥӴ
$`	λƥӴı
$'	λƥӴҲı
$$	ֱš
ע⣺ECMAScript v3 涨replace() Ĳ replacement Ǻַ£ÿƥ䶼øúصַΪ滻ıʹáúĵһƥģʽַĲģʽеӱʽƥַ 0 ĲĲһƥ stringObject гֵλáһ stringObject 
ʵ
 1
ڱУǽʹ "W3School" 滻ַе "Microsoft"
<script type="text/javascript">

var str="Visit Microsoft!"
document.write(str.replace(/Microsoft/, "W3School"))

</script>

Visit W3School!
 2
ڱУǽִһȫ滻ÿ "Microsoft" ҵͱ滻Ϊ "W3School"
<script type="text/javascript">

var str="Welcome to Microsoft! "
str=str + "We are proud to announce that Microsoft has "
str=str + "one of the largest Web Developers sites in the world."

document.write(str.replace(/Microsoft/g, "W3School"))

</script>

Welcome to W3School! We are proud to announce that W3School
has one of the largest Web Developers sites in the world.
 3
ʹñṩĴȷƥַдַȷ
text = "javascript Tutorial";
text.replace(/javascript/i, "JavaScript");
 4
ڱУǽ "Doe, John" תΪ "John Doe" ʽ
name = "Doe, John";
name.replace(/(\w+)\s*, \s*(\w+)/, "$2 $1");
 5
ڱУǽеĻ滻Ϊֱţ
name = '"a", "b"';
name.replace(/"([^"]*)"/g, "'$1'");
 6
ڱУǽַеʵĸתΪд
name = 'aaa bbb ccc';
uw=name.replace(/\b\w+\b/g, function(word){
  return word.substring(0,1).toUpperCase()+word.substring(1);}
  );
TIY
replace() 1
ʹ replace() 滻ַеַ
replace() 2 - ȫ
ʹ replace() ȫ滻
replace() 3 - ԴСде
ʹ replace() ȷдĸȷԡ
replace() 4
ʹ replace() תĸʽ
replace() 5
ʹ replace() תš
replace() 6
ʹ replace() ѵʵĸתΪд126ʽƥֵ()          ѰҡѰҡʽƥֵ



÷
search() ڼַַָʽƥַ
﷨
stringObject.search(regexp)
	
regexp	
òҪ stringObject мӴҲҪ RegExp 
עͣҪִкԴСдļ׷ӱ־ i
ֵ
stringObject еһ regexp ƥӴʼλá
עͣûҵκƥӴ򷵻 -1
˵
search() ִȫƥ䣬Ա־ gͬʱ regexp  lastIndex ԣǴַĿʼмζǷ stringObject ĵһƥλá
ʵ
 1
ڱУǽ "W3School"
<script type="text/javascript">

var str="Visit W3School!"
document.write(str.search(/W3School/))

</script>

6
У޷ w3schoolΪ search() ԴСдУ
<script type="text/javascript">

var str="Visit W3School!"
document.write(str.search(/w3school/))

</script>

-1
 2
ڱУǽִһκԴСдļ
<script type="text/javascript">

var str="Visit W3School!"
document.write(str.search(/w3school/i))

</script>

6
TIY
search()
ʹ search() ַָӴ
search() ԴСдļ
ʹ search() ַָӴ126ȡַƬϲرȡĲ()    ѡѡȡַƬϣµַзرȡĲ֡



÷
slice() ȡַĳ֣µַرȡĲ֡
﷨
stringObject.slice(start,end)
	
start	ҪȡƬϵʼ±ꡣǸò涨ǴַβʼλáҲ˵-1 ַָһַ-2 ָڶַԴơ
end	ҪȡƬεĽβ±ꡣδָ˲ҪȡӴ start ԭַβַòǸô涨Ǵַβʼλá
ֵ
һµַַ stringObject  start ʼ start end  endΪַֹ
˵
String ķ slice()substring()  substr() ʹãɷַָ֡slice()  substring() ҪһЩΪʹøΪslice()  substr() ͬΪַλָӴ substr() ַλúͳָӴ
ҪעǣString.slice()  Array.slice() ơ
ʵ
 1
ڱУǽȡλ 6 ʼַ
<script type="text/javascript">

var str="Hello happy world!"
document.write(str.slice(6))

</script>

happy world!
 2
ڱУǽȡλ 6 λ 11 ַ
<script type="text/javascript">

var str="Hello happy world!"
document.write(str.slice(6,11))

</script>

happy
TIY
slice()
ʹ slice() ַȡַ126ʹСֺʾַ()              СšСšʹСֺʾַ



÷
small() ڰַʾΪС֡
﷨
stringObject.small()
ʵ
ڱУ"Hello world!" ʾΪС֣
<script type="text/javascript">

var str="Hello world!"
document.write(str.small())

</script>
TIY
small()
ʹ small() ַʾΪС֡126ַָΪַ()            ַָָָΪַ顣



÷
split() ڰһַַָ顣
﷨
stringObject.split(separator,howmany)
	
separator	衣ַʽӸòָĵطָ stringObject
howmany	ѡòָص󳤶ȡ˸òصӴָ顣ûøòַᱻָĳȡ
ֵ
һַ顣ͨ separator ָı߽紦ַ stringObject ָӴġصеִ separator 
ǣ separator ǰӱʽʽôصаЩӱʽƥִʽƥı
ʾע
עͣѿַ ("")  separatorô stringObject еÿַ֮䶼ᱻָ
עͣString.split() ִеĲ Array.join ִеĲ෴ġ
ʵ
 1
ڱУǽղͬķʽַָ
<script type="text/javascript">

var str="How are you doing today?"

document.write(str.split(" ") + "<br />")
document.write(str.split("") + "<br />")
document.write(str.split(" ",3))

</script>

How,are,you,doing,today?
H,o,w, ,a,r,e, ,y,o,u, ,d,o,i,n,g, ,t,o,d,a,y,?
How,are,you
 2
ڱУǽָṹΪӵַ
"2:3:4:5".split(":")	//["2", "3", "4", "5"]
"|a|b|c".split("|")	//["", "a", "b", "c"]
 3
ʹĴ룬԰Ѿӷָɵʣ
var words = sentence.split(' ')
ʹʽΪ separator
var words = sentence.split(/\s+/)
 4
ϣѵʷָΪĸַָ߰ΪַʹĴ룺
"hello".split("")	//ɷ ["h", "e", "l", "l", "o"]
ֻҪһַʹ howmany 
"hello".split("", 3)	//ɷ ["h", "e", "l"]
TIY
split()
ʹ split() ַָ126ʹɾʾַ()              ɾߡɾߡʹɾʾַ



÷
strike() ʾɾߵַ
﷨
stringObject.strike()
ʵ
ڱУ"Hello world!" һɾߣ
<script type="text/javascript">

var str="Hello world!"
document.write(str.strike())

</script>
TIY
strike()
ʹ strike() ʾɾߵַ126ַʾΪ±()                  ±±ַʾΪ±ꡣ



÷
sub() ڰַʾΪ±ꡣ
﷨
stringObject.sub()
ʵ
ڱУ"Hello world!" ʾΪ±꣺
<script type="text/javascript">

var str="Hello world!"
document.write(str.sub())

</script>
TIY
sub()
ʹ sub() ַʾΪ±ꡣ126ʼȡַָĿַ()ȡȡʼȡַָĿַ



÷
substr() ַгȡ start ±꿪ʼָĿַ
﷨
stringObject.substr(start,length)
	
start	衣ҪȡӴʼ±ꡣֵǸôòַβʼλáҲ˵-1 ַָһַ-2 ָڶַԴơ
length	ѡӴеֵַʡ˸òôش stringObject Ŀʼλõβִ
ֵ
һµַ stringObject  start start ַָ ʼ length ַûָ lengthôصַ start  stringObject Ľβַ
ʾע
עͣsubstr() ĲָӴĿʼλúͳȣ substring()  slice() ʹá
ҪECMAscript ûжԸ÷б׼˷ʹ
Ҫ IE 4 У start ֵЧ BUG Уstart 涨ǵ 0 ַλá֮İ汾У BUG ѱ
ʵ
 1
ڱУǽʹ substr() ַȡһЩַ
<script type="text/javascript">

var str="Hello world!"
document.write(str.substr(3))

</script>

lo world!
 2
ڱУǽʹ substr() ַȡһЩַ
<script type="text/javascript">

var str="Hello world!"
document.write(str.substr(3,7))

</script>

lo worl
TIY
substr()
ʹ substr() ַȡһЩַ126ȡַַָ֮()ȡȡȡַַָ֮



÷
substring() ȡַнָ±ַ֮
﷨
stringObject.substring(start,stop)
	
start	衣һǸ涨ҪȡӴĵһַ stringObject еλá
stop	
ѡһǸҪȡӴһַ stringObject еλö 1
ʡԸòôصӴһֱַĽβ
ֵ
һµֵַַ stringObject һַǴ start  stop-1 ַ䳤Ϊ stop  start
˵
substring() صӴ start ַ stop ַ
 start  stop ȣô÷صľһմΪ 0 ַ start  stop ô÷ȡӴ֮ǰȽ
ʾע
Ҫ slice()  substr() ͬǣsubstring() ܸĲ
ʵ
 1
ڱУǽʹ substring() ַȡһЩַ
<script type="text/javascript">

var str="Hello world!"
document.write(str.substring(3))

</script>

lo world!
һ
 2
ڱУǽʹ substring() ַȡһЩַ
<script type="text/javascript">

var str="Hello world!"
document.write(str.substring(3,7))

</script>

lo w
һԡ126ַʾΪϱ()                  ϱϱַʾΪϱꡣ



÷
sup() ڰַʾΪϱꡣ
﷨
stringObject.sup()
ʵ
ڱУ"Hello world!" ʾΪϱ꣺
<script type="text/javascript">

var str="Hello world!"
document.write(str.sup())

</script>
TIY
sup()
ʹ sup() ַʾΪϱꡣ126ַתΪСд()                  СдСдַתΪСд



÷
toLocaleLowerCase() ڰַתΪСд
﷨
stringObject.toLocaleLowerCase()
ֵ
һµַ stringObject ддַȫתΪСдַ
˵
 toLowerCase() ͬǣtoLocaleLowerCase() ձطʽַתΪСдֻмԣеطеĴСдӳ䣬и÷ķֵͨ toLowerCase() һ
ʵ
ڱУ"Hello world!" Сдĸʾ
<script type="text/javascript">

var str="Hello World!"
document.write(str.toLocaleLowerCase())

</script>126ַתΪд()                  ддַתΪд



÷
toLocaleUpperCase() ڰַתΪд
﷨
stringObject.toLocaleUpperCase()
ֵ
һµַ stringObject СдַȫתΪ˴дַ
˵
 toUpperCase() ͬǣtoLocaleUpperCase() ձطʽַתΪдֻмԣеطеĴСдӳ䣬и÷ķֵͨ toUpperCase() һ
ʵ
ڱУ"Hello world!" Դдĸʾ
<script type="text/javascript">

var str="Hello World!"
document.write(str.toLocaleUpperCase())

</script>126ַתΪСд()                  СдСдַתΪСд


÷
toLowerCase() ڰַתΪСд
﷨
stringObject.toLowerCase()
ֵ
һµַ stringObject ддַȫתΪСдַ
ʵ
ڱУ"Hello world!" Сдĸʾ
<script type="text/javascript">

var str="Hello World!"
document.write(str.toLowerCase())

</script>
TIY
toLowerCase()
ʹ toLowerCase() ַתСд126ַתΪд()                  ддַתΪд


÷
toUpperCase() ڰַתΪд
﷨
stringObject.toUpperCase()
ֵ
һµַ stringObject СдַȫתΪ˴дַ
ʵ
ڱУ"Hello world!" Դдĸʾ
<script type="text/javascript">

var str="Hello World!"
document.write(str.toUpperCase())

</script>
TIY
toUpperCase()
ʹ toUpperCase() ַתɴд126Դ()                    ԴԴԴ롣126ַ()                          ȡȡַ



÷
toString() ַ
﷨
stringObject.toString()
ֵ
stringObject ԭʼֵַһ㲻ø÷
׳
ø÷Ķ String ʱ׳ TypeError 쳣

array.toString()  boolean.toString()  date.toString()  Number.toString()
array.toLocaleString()  date.toLocaleString()  Number.toLocaleString()
stringObject.valueOf()
JavaScript String οֲ126ĳַԭʼֵ()          ȡԭֵȡԭֵĳַԭʼֵ



÷
valueOf() ɷ String ԭʼֵ
ԭʼֵɴ String ж̳еġ
valueOf() ͨ JavaScript ں̨ԶеãʽشڴС
﷨
stringObject.valueOf()
׳
ø÷Ķ String ʱ׳ TypeError 쳣8ʽʽRegExp 
RegExp ʾʽǶִַģʽƥǿ󹤾ߡ
ֱ﷨
/pattern/attributes
 RegExp ﷨
new RegExp(pattern, attributes);

 pattern һַָʽģʽʽ
 attributes һѡַ "g""i"  "m"ֱָȫƥ䡢ִСдƥͶƥ䡣ECMAScript ׼֮ǰ֧ m ԡ pattern ʽַʡԸò
ֵ
һµ RegExp 󣬾ָģʽͱ־ pattern ʽַô RegExp() 캯ָ RegExp ͬģʽͱ־һµ RegExp 
 new  RegExp() ΪãôΪ new ʱһֻǵ pattern ʽʱֻ patternٴһµ RegExp 
׳
SyntaxError -  pattern ǺϷʽ attributes  "g""i"  "m" ַ֮׳쳣
TypeError -  pattern  RegExp 󣬵ûʡ attributes ׳쳣164RegExp Ƿб־ g             ȫ֡ȫ֡RegExp Ƿб־ g



÷
global ڷʽǷб־ "g"
˸ʽǷִȫƥ䡣
 g ־ãΪ trueΪ false
﷨
RegExpObject.global
ʵ
Уǽ鿴ʽǷб־ g
<script type="text/javascript">
var str = "Visit W3School.com.cn";
var patt1 = new RegExp("W3");

if(patt1.global)
  {
  alert("Global property is set");
  }
else
  {
  alert("Global property is NOT set.");
  }
</script>
TIY
global
ʹ global ʽǷб־ g164RegExp Ƿб־ i             ǷiǷiRegExp Ƿб־ i




÷
ignoreCase Թ涨Ƿ "i" ־
 "i" ־򷵻 true򷵻 false
﷨
RegExpObject.ignoreCase
ʵ
Уǽ鿴ʽǷб־ i
<script type="text/javascript">
var str = "Visit W3School";
var patt1 = new RegExp("W3");

if(patt1.ignoreCase)
  {
  alert("ignoreCase property is set");
  }
else
  {
  alert("ignoreCase property is NOT set.");
  }
</script>
TIY
ignoreCase
ʹ ignoreCase ʽǷб־ i164һʾʼһƥַλá´λá´λáһʾʼһƥַλá



÷
lastIndex ڹ涨´ƥʼλá
﷨
RegExpObject.lastIndex
˵
Դһһƥı֮ĵһַλá
ϴƥĽɷ RegExp.exec()  RegExp.test() ҵģǶ lastIndex ָλΪ´μʼ㡣Ϳͨһַеƥı
ǿɶдġֻҪĿַһʼͿԶá exec()  test() ҲҲƥıʱǻԶ lastIndex Ϊ 0
ʾע
Ҫб־ g Ͳʾȫģʽ RegExp ʹ lastIndex ԡ
ʾڳɹƥĳַ֮ͿʼһµַҪֶذΪ 0
ʵ
Уǽƥ֮ lastIndex ԣ
<script type="text/javascript">
var str = "The rain in Spain stays mainly in the plain";
var patt1 = new RegExp("ain", "g");

patt1.test(str)
document.write("Match found. index now at: " + patt1.lastIndex);
</script>
TIY
lastIndex
ʹ lastIndex Ӻδʼһƥ䡣164RegExp Ƿб־ m             ǷmǷmRegExp Ƿб־ m


÷
multiline ڷʽǷб־ m
˸ʽǷԶģʽִģʽƥ䡣
ģʽУҪַклз^  $ êƥַĿͷͽβ⻹ƥÿеĿͷͽβ
磬ģʽ /W3School$/im ƥ "w3school"  "W3School\nisgreat"\n ǻз\u000A
 m ־ãΪ trueΪ false
﷨
RegExpObject.multiline
ʵ
Уǽ鿴ʽǷб־ m
<script type="text/javascript">
var str = "Visit W3School.com.cn";
var patt1 = new RegExp("W3","m");

if(patt1.multiline)
  {
  alert("Multiline property is set");
  }
else
  {
  alert("Multiline property is NOT set.");
  }
</script>
TIY
multiline
ʹ multiline ʽǷб־ m164ʽԴı                    ԴıԴıʽԴı




÷
source ڷģʽƥõı
ıʽֱʹõĶҲ־ gim
﷨
RegExpObject.source
ʵ
Уǽģʽƥı
<script type="text/javascript">
var str = "Visit W3School.com.cn";
var patt1 = new RegExp("W3S","g");

document.write("The regular expression is: " + patt1.source);
</script>
TIY
source
ʹ source ģʽƥı164ʽ()                        ııʽ



÷
compile() ڽűִйбʽ
compile() Ҳڸı±ʽ
﷨
RegExpObject.compile(regexp,modifier)
	
regexp	ʽ
modifier	涨ƥ͡"g" ȫƥ䣬"i" ִСд"gi" ȫִСдƥ䡣
ʵ
ַȫ "man" "person" 滻Ȼͨ compile() ıʽ "person" 滻 "man"  "woman"
<script type="text/javascript">

var str="Every man in the world! Every woman on earth!";

patt=/man/g;
str2=str.replace(patt,"person");
document.write(str2+"<br />");

patt=/(wo)?man/g;
patt.compile(patt);
str2=str.replace(patt,"person");
document.write(str2);

</script>

Every person in the world! Every woperson on earth!
Every person in the world! Every person on earth!
TIY
TIY
compile()
ʹ compile() ıʽ164ֵַָҵֵȷλ()ѰҡѰҡֵַָҵֵȷλá



÷
exec() ڼַеʽƥ䡣
﷨
RegExpObject.exec(string)
	
string	衣Ҫַ
ֵ
һ飬дƥĽδҵƥ䣬򷵻ֵΪ null
˵
exec() ĹܷǳǿһͨõķʹҲ test() Լ֧ʽ String ķΪӡ
 exec() ҵƥı򷵻һ顣򣬷 nullĵ 0 Ԫʽƥı 1 Ԫ RegExpObject ĵ 1 ӱʽƥıеĻ 2 Ԫ RegExpObject ĵ 2 ӱʽƥıеĻԴơԪغ length ֮⣬exec() ԡindex ƥıĵһַλáinput ŵǱַ stringǿԿóڵ÷ȫֵ RegExp  exec() ʱص÷ String.match() صͬġ
ǣ RegExpObject һȫʽʱexec() Ϊ΢һЩ RegExpObject  lastIndex ַָʼַ string exec() ҵʽƥıʱƥ RegExpObject  lastIndex Ϊƥıһַһλá˵ͨ exec() ַеƥı exec() ҲҲƥıʱ null lastIndex Ϊ 0
ʾע
Ҫһַһģʽƥ֮Ҫʼµַͱֶذ lastIndex Ϊ 0
ʾע⣬ RegExpObject Ƿȫģʽexec() ϸӵصС exec()  String.match() Ĳ֮ͬȫģʽ·صϢҪٵöࡣǿô˵ѭзص exec() ΨһһֻȫģʽģʽƥϢķ
ʵ
ڱУǽȫַּе W3School
<script type="text/javascript">

var str = "Visit W3School"; 
var patt = new RegExp("W3School","g");
var result;

while ((result = patt.exec(str)) != null)  {
  document.write(result);
  document.write("<br />");
  document.write(patt.lastIndex);
 }
</script>

W3School
14
һ
TIY
exec()
ʹ exec() ַ164ֵַָtruefalse()   ڡڡֵַָ true  false



÷
test() ڼһַǷƥĳģʽ.
﷨
RegExpObject.test(string)
	
string	衣Ҫַ
ֵ
ַ string к RegExpObject ƥı򷵻 true򷵻 false
˵
 RegExp  r  test() Ϊַ sʾʽǵȼ۵ģ(r.exec(s) != null)
ʵ
Уǽ "W3School"
<script type="text/javascript">
var str = "Visit W3School";
var patt1 = new RegExp("W3School");

var result = patt1.test(str);

document.write("Result: " + result);
</script>

Result: true
TIY
test()
ʹ test() ַ164ηη173ִжԴСдеƥ䡣              iiִжԴСдеƥ䡣



÷
i ηִжԴСдеƥ䡣
﷨
new RegExp("regexp","i")
ֱ﷨
/regexp/i
֧
֧ i η
ʵ
ַе "w3school" вִСд
var str="Visit W3School";
var patt1=/w3school/i;
汻ǵıʾ˱ʽƥλã
Visit W3School
      --------
TIY173ִȫƥ(ƥڵһƥֹ)  ggִȫƥ䣨ƥҵһƥֹͣ



÷
g ηִȫƥ䣨ƥҵһƥֹͣ
﷨
new RegExp("regexp","g")
ֱ﷨
/regexp/g
֧
֧ g η
ʵ
 1
 "is" ȫ
var str="Is this all there is?";
var patt1=/is/g;
汻ǵıʾ˱ʽƥλã
Is this all there is?
     --           --
TIY
 2
 "is" ȫҴСде
var str="Is this all there is?";
var patt1=/is/gi;
汻ǵıʾ˱ʽƥλã
Is this all there is?
--   --           --
TIY173ִжƥ䡣                          mmִжƥ䡣164ššڲĳΧڵַ177ҷ֮κַ              [abc][abc]ҷ֮κַ



÷
[abc] ʽڲҷ֮κַ
ڵַκַַΧ
﷨
new RegExp("[abc]")
ֱ﷨
/[abc]/
֧
֧ [abc] ʽ
ʵ
ַжַΧ [a-h] ȫ
var str="Is this all there is?";
var patt1=/[a-h]/g;
汻ǵıʾ˱ʽƥλã
Is this all there is?
    -   -    -- -
177κβڷַ֮          [^abc][^abc]κβڷַ֮



÷
[^abc] ʽڲκβڷַ֮
ڵַκַַΧ
﷨
new RegExp("[^xyz]")
ֱ﷨
/[^xyz]/
֧
֧ [^abc] ʽ
ʵ
ԲַΧ [a-h] ڵַȫ
var str="Is this all there is?";
var patt1=/[^a-h]/g;
汻ǵıʾ˱ʽƥλã
Is this all there is?
-- - --  -- -  -  --177κδ 0  9 ֡              [0-9][0-9]κδ 0  9 ֡177κδСд a Сд z ַ      [a-z][a-z]κδСд a Сд z ַ177κδӴд A д Z ַ      [A-Z][A-Z]κδӴд A д Z ַ177κδӴд A Сд z ַ      [A-z][A-z]κδӴд A Сд z ַ177Ҹڵκַ              [adgk][adgk]Ҹڵκַ177Ҹκַ              [^adgk][^adgk]Ҹκַ177κָѡ                    (red|blue|green)(red|blue|green)κָѡ164ԪַԪַԪַMetacharacterӵ⺬ַ187ҵַ˻кн      ..ҵַ˻кн



÷
. Ԫַڲҵַ˻кн
﷨
new RegExp("regexp.")
ֱ﷨
/regexp./
֧
֧ . Ԫַ
ʵ
ַе "h.t" ȫ
var str="That's hot!";
var patt1=/h.t/g;
汻ǵıʾ˱ʽƥλã
That's hot!
 ---   ---187ҵַ                          \w\wҵַ



÷
\w Ԫַڲҵַ
﷨
new RegExp("\w")
ֱ﷨
/\w/
֧
֧ \w Ԫַ
ʵ
ַеĵַȫ
var str="Give 100%!";
var patt1=/\w/g;
汻ǵıʾ˱ʽƥλã
Give 100%!
---- ---187ҷǵַ                        \W\Wҷǵַ



÷
\W Ԫַڲҷǵַ
ַa-zA-Z0-9Լ»ߡ
﷨
new RegExp("\W")
ֱ﷨
/\W/
֧
֧ \W Ԫַ
ʵ
ַеķǵַȫ
var str="Give 100%!";
var patt1=/\W/g;
汻ǵıʾ˱ʽƥλã
Give 100%!
        --187֡                              \d\d֡



÷
\d Ԫַڲַ
﷨
new RegExp("\d")
ֱ﷨
/\d/
֧
֧ \d Ԫַ
ʵ
ֽȫ
var str="Give 100%!";
var patt1=/\d/g;
汻ǵıʾ˱ʽƥλã
Give 100%!
     ---187ҷַ                        \D\Dҷַ



÷
\D Ԫַڲҷַ
﷨
new RegExp("\D")
ֱ﷨
/\D/
֧
֧ \D Ԫַ
ʵ
ַеķַȫ
var str="Give 100%!";
var patt1=/\D/g;
汻ǵıʾ˱ʽƥλã
Give 100%!
----    --187ҿհַ                          \s\sҿհַ



÷
\s Ԫַڲҿհַ
հַǣ
ո (space character)
Ʊ (tab character)
س (carriage return character)
з (new line character)
ֱз (vertical tab character)
ҳ (form feed character)
﷨
new RegExp("\s")
ֱ﷨
/\s/
֧
֧ \s Ԫַ
ʵ
ַеĿհַȫ
var str="Is this all there is?";
var patt1=/\s/g;
汻ǵıʾ˱ʽƥλã
Is this all there is?
  -    -   -     -187ҷǿհַ                        \S\Sҷǿհַ


÷
\S Ԫַڲҷǿհַ
հַǣ
ո (space character)
Ʊ (tab character)
س (carriage return character)
з (new line character)
ֱз (vertical tab character)
ҳ (form feed character)
﷨
new RegExp("\S")
ֱ﷨
/\S/
֧
֧ \S Ԫַ
ʵ
ַеķǿհַȫ
var str="Is this all there is?";
var patt1=/\S/g;
汻ǵıʾ˱ʽƥλã
Is this all there is?
-- ---- --- ----- ---187ƥ䵥ʱ߽硣                          \b\bƥ䵥ʱ߽硣



÷
\b Ԫַƥ䵥ʱ߽硣
ڵʱ߽ƥλãַǰ治һֱַڡע⣬ƥĵʱ߽粢ƥС仰˵ƥĵʱ߽ĳΪ㡣Ҫ [\b] 
δҵƥ䣬򷵻 null
ʾ\b ԪַͨڲλڵʵĿͷβƥ䡣
ӣ
/\bm/ ƥ "moon" е 'm'
/oo\b/ ƥ "moon" е 'oo'Ϊ 'oo'  'n' һַ
/oon\b/ ƥ "moon" е 'oon'Ϊ 'oon' λַĩˣûеַ
/\w\b\w/ ƥκַΪַ֮ͬʱŷǵַ͵ַ
һ
﷨
new RegExp("\bregexp")
ֱ﷨
/\bregexp/
֧
֧ \b Ԫַ
ʵ
ַеĵʵĿͷβ "W3" ȫ
var str="Visit W3School";
var patt1=/\bW3/g;
汻ǵıʾ˱ʽƥλã
Visit W3School
      --187ƥǵʱ߽硣                        \B\Bƥǵʱ߽硣



÷
\B Ԫַƥǵʱ߽硣ƥλõһһַͬģͬʱǵʣͬʱǷǵַַĿͷͽβΪǵַ
δҵƥ䣬򷵻 null
ʾ\B ԪַͨڲҲڵʵĿͷβƥ䡣
磺/\B../ ƥ "noonday" е 'oo' /y\B./ ƥ "possibly yesterday." е 'ye'
һ
﷨
new RegExp("\Bregexp")
ֱ﷨
/\Bregexp/
֧
֧ \B Ԫַ
ʵ
ַвλڵʿͷβ "School" ȫ
var str="Visit W3School";
var patt1=/\BSchool/g;
汻ǵıʾ˱ʽƥλã
Visit W3School
        ------187 NUL ַ                         \0\0 NUL ַ187һз                            \n\nһз




÷
\n Ԫַڲһз
\n ػзҵλáδҵƥ䣬򷵻 -1
﷨
new RegExp("\n")
ֱ﷨
/\n/
֧
֧ \n Ԫַ
ʵ
ַеĻַ
var str="Visit W3School.\nLearn Javascript.";
var patt1=/\n/;
汻ǵıʾ˱ʽƥλã
Visit W3School.\nLearn Javascript.
               --187һҳ                            \f\fһҳ187һس                            \r\rһس187Ʊ                            \t\tƱ187ҴֱƱ                        \v\vҴֱƱ187԰˽ xxx 涨ַ         \xxx\xxx԰˽ xxx 涨ַ



÷
\xxx Ԫַڲ԰˽ xxx 涨ַ
δҵƥ䣬򷵻 null
﷨
new RegExp("\xxx")
ֱ﷨
/\xxx/
֧
֧ \xxx Ԫַ
ʵ
ַеİ˽ 127 (W) ȫ
var str="Visit W3School. Hello World!";
var patt1=/\127/g;
汻ǵıʾ˱ʽƥλã
Visit W3School. Hello World!
      -               -187ʮ dd 涨ַ        \xdd\xddʮ dd 涨ַ



÷
\xdd Ԫַʮ dd 涨ַ
δҵƥ䣬򷵻 null
﷨
new RegExp("\xdd")
ֱ﷨
/\xdd/
֧
֧ \xdd Ԫַ
ʵ
ַеʮ 57 (W) ȫ
var str="Visit W3School. Hello World!";
var patt1=/\x57/g;
汻ǵıʾ˱ʽƥλã
Visit W3School. Hello World!
      -               -187ʮxxxx涨Unicodeַ \uxxxx\uxxxxʮ xxxx 涨 Unicode ַ



÷
\uxxxx Ԫַڲʮ xxxx 涨 Unicode ַ
δҵƥ䣬򷵻 null
﷨
new RegExp("\uxxxx")
ֱ﷨
/\uxxxx/
֧
֧ \uxxxx Ԫַ
ʵ
ַеʮ 0057 (W) ȫ
var str="Visit W3School. Hello World!";
var patt1=/\u0057/g;
汻ǵıʾ˱ʽƥλã
Visit W3School. Hello World!
      -               -164ʡʡ206ƥκΰһ n ַ       n+n+ƥκΰһ n ַ




÷
n+ ƥһ n κַ
﷨
new RegExp("n+")
ֱ﷨
/n+/
֧
֧ + ʡ
ʵ
 1
һ "o" ȫ
var str="Hellooo World! Hello W3School!";
var patt1=/o+/g;
汻ǵıʾ˱ʽƥλã
Hellooo World! Hello W3School!
    ---  -         -      --
TIY
 2
һַȫ
var str="Hello World! Hello W3School!";
var patt1=/\w+/g;
汻ǵıʾ˱ʽƥλã
Hello World! Hello W3School!
----- -----  ----- --------206ƥκΰ n ַ     n*n*ƥκΰ n ַ

÷
n+ ƥ n κַ
﷨
new RegExp("n*")
ֱ﷨
/n*/
֧
֧ * ʡ
ʵ
 1
 "l" ȫһ "o"
var str="Hellooo World! Hello W3School!";
var patt1=/lo*/g;
汻ǵıʾ˱ʽƥλã
Hellooo World! Hello W3School!
  -----    -     ---        -
TIY
 2
 "1" ȫһ "0"
var str="1, 100 or 1000?";
var patt1=/10*/g;
汻ǵıʾ˱ʽƥλã
1, 100 or 1000?
-  ---    ----206ƥκΰһ n ַ     n?n?ƥκΰһ n ַ



÷
n? ƥκΰһ n ַ
﷨
new RegExp("n?")
ֱ﷨
/n?/
֧
֧ ? ʡ
ʵ
 "1" ȫһ "0"
var str="1, 100 or 1000?";
var patt1=/10?/g;
汻ǵıʾ˱ʽƥλã
1, 100 or 1000?
-  --     --206ƥ X  n еַ        n{X}n{X}ƥ X  n еַ




÷
n{X,} ƥ X  n еַ
X ֡
﷨
new RegExp("n{X}")
ֱ﷨
/n{X}/
֧
֧ {X} ʡ
ʵ
԰λеӴȫ
var str="100, 1000 or 10000?";
var patt1=/\d{4}/g;
汻ǵıʾ˱ʽƥλã
100, 1000 or 10000?
     ----    ----206ƥ X  Y  n еַ   n{X,Y}n{X,Y}ƥ X  Y  n еַ



÷
n{X,Y} ƥ X  Y  n еַ
X  Y ֡
﷨
new RegExp("n{X,Y}")
ֱ﷨
/n{X,Y}/
֧
֧ {X,Y} ʡ
ʵ
԰λλеӴȫ
var str="100, 1000 or 10000?";
var patt1=/\d{3,4}/g;
汻ǵıʾ˱ʽƥλã
100, 1000 or 10000?
---  ----    ----206ƥ X  n еַ    n{X,}n{X,}ƥ X  n еַ




÷
n{X,} ƥ X  n еַ
X ֡
﷨
new RegExp("n{X,}")
ֱ﷨
/n{X,}/
֧
֧ {X,} ʡ
ʵ
԰λеӴȫ
var str="100, 1000 or 10000?";
var patt1=/\d{3,}/g;
汻ǵıʾ˱ʽƥλã
100, 1000 or 10000?
---  ----    -----206ƥκνβΪ n ַ             n$n$ƥκνβΪ n ַ



n$ ƥκνβΪ n ַ
﷨
new RegExp("n$")
ֱ﷨
/n$/
֧
֧ $ ʡ
ʵ
ַβ "is" ȫ
var str="Is this his";
var patt1=/is$/g;
汻ǵıʾ˱ʽƥλã
Is this his
         --206ƥκοͷΪ n ַ             ^n^nƥκοͷΪ n ַ




÷
n^ ƥκοͷΪ n ַ
﷨
new RegExp("^n")
ֱ﷨
/^n/
֧
֧ ^ ʡ
ʵ
ַͷ "is" ȫ
var str="Is this his";
var patt1=/^Is/g;
汻ǵıʾ˱ʽƥλã
Is this his
--206ƥκַָ n ַ ?=n?=nƥκַָ n ַ



÷
?=n ƥκַָ n ַ
﷨
new RegExp("regexp(?=n)")
ֱ﷨
/regexp(?=n)/
֧
֧ ?= ʡ
ʵ
 "all"  "is" ȫ
var str="Is this all there is";
var patt1=/is(?= all)/g;
汻ǵıʾ˱ʽƥλã
Is this all there is
     --206ƥκûַָnַ ?!n?!nƥκûнַָ n ַ



÷
?!n ƥûнַָ n κַ
﷨
new RegExp("regexp(?!n)")
ֱ﷨
/regexp(?!n)/
֧
֧ ?! ʡ
ʵ
ûн "all"  "is" ȫ
var str="Is this all there is";
var patt1=/is(?! all)/gi;
汻ǵıʾ˱ʽƥλã
Is this all there is
--                --8ȫ֡ȫ֡ȫֶ
ȫֶԤĶΪ JavaScript ȫֺȫԵռλͨʹȫֶ󣬿ԷԤĶ󡢺ԡȫֶκζԣûơ
ڶ JavaScript Уùؼ this ȫֶ󡣵ַͨʽȫֶΪȫֶͷζз޶ԵıͺΪöѯ磬JavaScript  parseInt() ʱõȫֶ parseInt ԡȫֶͷζڶ JavaScript бΪȫֶԡ
ȫֶֻһ󣬶ࡣûй캯Ҳ޷ʵһµȫֶ
 JavaScript Ƕһ⻷ʱȫֶͨлضԡʵϣECMAScript ׼ûй涨ȫֶͣJavaScript ʵֻǶ JavaScript ԰͵ĶΪȫֶֻҪöгĻԺͺ磬ͨ LiveConnect صļű Java  JavaScript ʵУȫֶ󱻸г java  Package Լ getClass() ڿͻ JavaScript Уȫֶ Window 󣬱ʾ JavaScript  Web ڡ

 JavaScript УȫֶԤԶǲöٵģп for/in ѭгʽʽȫֱʾ
var variables = "";

for (var name in this) 
{
variables += name + "<br />";
}

document.write(variables);217ֵ                  ֵ



÷
Infinity ڴűʾֵ
﷨
Infinity
˵
޷ʹ for/in ѭö Infinity ԣҲ delete ɾ
Infinity ǳ԰Ϊֵ
ʵ
ڱУǽչʾһ infinity Ʒ
<script type="text/javascript">

var t1=1.7976931348623157E+10308
document.write(t1)

document.write("<br />")

var t2=-1.7976931348623157E+10308
document.write(t2)

</script>

Infinity
-Infinity
TIY
Infinity
һ infinity ƻᷢʲôأ217 java.* 㼶һ JavaPackage  javajava java.* 㼶һ JavaPackage



÷
ʾ java.* 㼶 JavaPackage
﷨
java
˵
ڰ LiveConnect ڽű Java ļ JavaScript ʵУȫ java Ծһ JavaPackage ʾ java.* 㼶ԵĴζ java.util һ JavaScript ʾʽõ java.util ڲ java.* 㼶 Java ȫ Packages ԡ217ָʾĳֵǲֵ                ָʾĳֵǲֵ




÷
NaN ķֵ
﷨
NaN
˵
޷ʹ for/in ѭö NaN ԣҲ delete ɾ
NaN ǳ԰Ϊֵ
ʾע
ʾʹ isNaN() жһֵǷ֡ԭ NaN ֵȣԼ
ʵ
ڱУǽչʾһ infinity Ʒ
<script type="text/javascript">

var test1="300"
var test2="Hello World!"

document.write(Number(test1)+ "<br />")
document.write(Number(test2)+ "<br />")

document.write(isNaN(test1)+ "<br />")
document.write(isNaN(test2))

</script>

300
NaN
false
true
TIY
NaN
ͨ NaN жһֵ217 JavaPackage                    PackagesPackages JavaPackage 


÷
 JavaPackage
﷨
Packages
˵
ڰ LiveConnect ڽű Java ļ JavaScript ʵУȫ Packages Ծһ JavaPackage  Java ֪аĸ磬Packages.javax.swing õ Java  javax.swingȫ java  Packages.java ļд217ָʾδֵ                        δδָʾδֵ


÷
undefined ڴ JavaScript  undefined ֵ
﷨
undefined
˵
޷ʹ for/in ѭö undefined ԣҲ delete ɾ
undefined ǳ԰Ϊֵ
ԶȡڵĶʱҲ᷵ undefined
ʾע
ʾֻ === ĳֵǷδģΪ == Ϊ undefined ֵȼ null
עͣnull ʾֵ undefined ʾһδıûиֵıһڵĶԡ
ʵ
ڱУǽδһ
<script type="text/javascript">

var t1=""
var t2

if (t1===undefined) {document.write("t1 is undefined")}
if (t2===undefined) {document.write("t2 is undefined")}

</script>

t2 is undefined
TIY
undefined
μδһ217ĳ URI()                    URIURIĳ URI


÷
decodeURI() ɶ encodeURI()  URI н롣
﷨
decodeURI(URIstring)
	
URIstring	衣һַҪ URI Ҫı
ֵ
URIstring ĸеʮתнǱʾַ滻
ʵ
ڱУǽʹ decodeURI() һ URI н룺
<script type="text/javascript">

var test1="http://www.w3school.com.cn/My first/"

document.write(encodeURI(test1)+ "<br />")
document.write(decodeURI(test1))

</script>

http://www.w3school.com.cn/My%20first/
http://www.w3school.com.cn/My first/
TIY
decodeURI()
ʹ decodeURI() Ա URI н롣217һ URI ()               һ URI 



÷
decodeURIComponent() ɶ encodeURIComponent()  URI н롣
﷨
decodeURIComponent(URIstring)
	
URIstring	衣һַб URI Ҫı
ֵ
URIstring ĸеʮתнǱʾַ滻
ʵ
ڱУǽʹ decodeURIComponent() Ա URI н룺
<script type="text/javascript">

var test1="http://www.w3school.com.cn/My first/"

document.write(encodeURIComponent(test1)+ "<br />")
document.write(decodeURIComponent(test1))

</script>

http%3A%2F%2Fwww.w3school.com.cn%2FMy%20first%2F
http://www.w3school.com.cn/My first/
TIY
decodeURIComponent()
ʹ decodeURIComponent() Ա URI н롣217ַΪ URI()                    URIURIַΪ URI


÷
encodeURI() ɰַΪ URI б롣
﷨
encodeURI(URIstring)
	
URIstring	衣һַ URI Ҫı
ֵ
URIstring ĸеĳЩַʮƵתн滻
˵
÷ ASCII ĸֽб룬ҲЩ ASCII Žб룺 - _ . ! ~ * ' ( ) 
÷ĿǶ URI ı룬˶ URI о⺬ ASCII ţencodeURI() ǲתģ;/?:@&=+$,#
ʾע
ʾ URI кзָ ?  #Ӧʹ encodeURIComponent() ֱԸб롣
ʵ
ڱУǽʹ encodeURI()  URI б룺
<script type="text/javascript">

document.write(encodeURI("http://www.w3school.com.cn")+ "<br />")
document.write(encodeURI("http://www.w3school.com.cn/My first/"))
document.write(encodeURI(",/?:@&=+$#"))

</script>

http://www.w3school.com.cn
http://www.w3school.com.cn/My%20first/
,/?:@&=+$#217ַΪ URI ()               ַΪ URI 


÷
encodeURIComponent() ɰַΪ URI б롣
﷨
encodeURIComponent(URIstring)
	
URIstring	衣һַ URI Ҫı
ֵ
URIstring ĸеĳЩַʮƵתн滻
˵
÷ ASCII ĸֽб룬ҲЩ ASCII Žб룺 - _ . ! ~ * ' ( ) 
ַ ;/?:@&=+$,# Щڷָ URI ıţһʮƵת滻ġ
ʾע
ʾע encodeURIComponent()   encodeURI() ֮ǰ߼ٶĲ URI һ֣Э顢·ѯַ encodeURIComponent() תڷָ URI ֵıš
ʵ
ڱУǽʹ encodeURIComponent()  URI б룺
<script type="text/javascript">

document.write(encodeURIComponent("http://www.w3school.com.cn"))
document.write("<br />")
document.write(encodeURIComponent("http://www.w3school.com.cn/p 1/"))
document.write("<br />")
document.write(encodeURIComponent(",/?:@&=+$#"))

</script>

http%3A%2F%2Fwww.w3school.com.cn
http%3A%2F%2Fwww.w3school.com.cn%2Fp%201%2F
%2C%2F%3F%3A%40%26%3D%2B%24%23
TIY
encodeURIComponent()
ʹ encodeURIComponent() 벻ͬ URI217ַб()                      ַб롣


÷
escape() ɶַб룬Ϳеļ϶ȡַ
﷨
escape(string)
	
string	衣Ҫתַ
ֵ
ѱ string ĸĳЩַ滻ʮƵתС
˵
÷ ASCII ĸֽб룬ҲЩ ASCII Žб룺 * @ - _ + . / еַᱻת滻
ʾע
ʾʹ unescape()  escape() ַн롣
עͣECMAScript v3 ʹø÷Ӧʹ decodeURI()  decodeURIComponent() 
ʵ
ڱУǽʹ escape() ַ
<script type="text/javascript">

document.write(escape("Visit W3School!") + "<br />")
document.write(escape("?!=()#%&"))

</script>

Visit%20W3School%21
%3F%21%3D%28%29%23%25%26217JavaScriptַΪִ()  ִСִС JavaScript ַΪűִС



÷
eval() ɼĳִַеĵ JavaScript 롣
﷨
eval(string)
	
string	衣ҪַкҪ JavaScript ʽҪִе䡣
ֵ
ͨ string õֵеĻ
˵
÷ֻԭʼַΪ string ԭʼַô÷κθıطء벻ҪΪ eval()  String Ϊ
ͼ eval Ի eval() һԣͨԵ ECMAScript ʵ׳һ EvalError 쳣
׳
ûкϷıʽ䣬׳ SyntaxError 쳣
Ƿ eval()׳ EvalError 쳣
ݸ eval()  Javascript һ쳣eval() Ѹ쳣ݸߡ
ʾע
ʾȻ eval() Ĺܷǳǿ󣬵ʵʹõࡣ
ʵ
 1
ڱУǽڼַ eval()صĽ
<script type="text/javascript">

eval("x=10;y=20;document.write(x*y)")

document.write(eval("2+2"))

var x=10
document.write(eval(x+17))

</script>

200
4
27217һ JavaObject  JavaClass()      javajavaһ JavaObject  JavaClass


÷
getClass() ɷһ JavaObject  JavaClass
﷨
getClass(javaobj)
	
javaobj	һ JavaObject 
ֵ
javaobj  JavaClass 
˵
úɽһ JavaObject Ϊظö JavaClass JavaClass 󡣸 JavaClass ʾ Java  Java ࣬ Java ʾ Java  JavaObject ָġ
ϰ÷
벻Ҫ JavaScript  getClass()  Java  getClass һҲҪ JavaScript  JavaClass  Java java.lang.Class ˡ
뿴д룬ɴһ Java Rectangle 
var obj = new java.awt.Rectangle();
obj һ JavaObject  JavaScript ǿԵ JavaScript  getClass() һ JavaClass 󣬸 JavaClass ʾ java.awt.Rectangle ࣺ
var cls = getClass(obj);
 Java getClass() ķʽִͬȫͬĹܣ
cls = obj.getClass();
ִдcls Ǳʾ java.lang.class һ Java Object java.lang.class һ Java  java.awt.Rectangle һ Java ʾ
󣬶κε JavaObject objdoῴıʾʽʼΪ true
(getClass(obj.getClass()) == java.lang.Class)217ĳֵǷΪ()            ĳֵǷΪ


÷
isFinite() ڼǷ
﷨
isFinite(number)
	
number	衣Ҫ֡
ֵ
 number ֣תΪ֣ô true number  NaN֣򷵻 false
ʵ
ڱУǽʹ isFinite() ڼ
<script type="text/javascript">

document.write(isFinite(123)+ "<br />")
document.write(isFinite(-1.23)+ "<br />")
document.write(isFinite(5-2)+ "<br />")
document.write(isFinite(0)+ "<br />")
document.write(isFinite("Hello")+ "<br />")
document.write(isFinite("2005/12/12")+ "<br />")

</script>

true
true
true
true
false
false
TIY
isFinite()
ʹ isFinite()217ĳֵǷ()                  ĳֵǷ֡


÷
isNaN() ڼǷǷֵ
﷨
isNaN(x)
	
x	衣Ҫֵ
ֵ
 x ķֵ NaNܱתΪֵصֵ true x ֵ,򷵻 false
˵
isNaN() жǷ NaNֵʾһǷ֣类 0 õĽ
 NaN κֵȵõĽ falseҪжĳֵǷ NaNʹ ==  === ΪˣisNaN() Ǳġ
ʾע
ʾisNaN() ͨڼ parseFloat()  parseInt() ĽжǱʾǷǺϷ֡ȻҲ isNaN() 󣬱 0 
ʵ
ǷǷ
<script>

document.write(isNaN(123));
document.write(isNaN(-1.23));
document.write(isNaN(5-2));
document.write(isNaN(0));
document.write(isNaN("Hello"));
document.write(isNaN("2005/12/12"));

</script>

false
false
false
false
true
true
һԡ217ѶֵתΪ()                  ȡȡѶֵתΪ֡


÷
Number() ѶֵתΪ֡
﷨
Number(object)
	
object	衣JavaScript 
ֵ
 Date Number() ش 1970  1  1 ĺ
ֵ޷תΪ֣ô Number()  NaN
ʵ
ڱУǽ԰ѲͬĶתΪ֣
<script type="text/javascript">

var test1= new Boolean(true);
var test2= new Boolean(false);
var test3= new Date();
var test4= new String("999");
var test5= new String("999 888");

document.write(Number(test1)+ "<br />");
document.write(Number(test2)+ "<br />");
document.write(Number(test3)+ "<br />");
document.write(Number(test4)+ "<br />");
document.write(Number(test5)+ "<br />");

</script>

1
0
1256657776588
999
NaN
TIY
Number()
ʹ Number() ѶֵתΪ֡217һַһ()        ȡȡһַһ



÷
parseFloat() ɽһַһ
úַָе׸ַǷ֡ǣַнֱֵĩΪֹȻַظ֣Ϊַ
﷨
parseFloat(string)
	
string	衣Ҫַ
ϸ˵
parseFloat ȫֺκζ
parseFloat ַΪءڽţ+  - (0-9)С㣬߿ѧеָe  EַԸַԼַ֮صǰѾĸͬʱַλĿհ׷ᱻԡ
ַĵһַܱΪ֣ parseFloat  NaN
ʾͨ isNaN ж parseFloat ķؽǷ NaN NaN ΪѧĲضҲ NaN
ֵ
ؽ֡
ʾע
עͣͷͽβĿոġ
ʾַĵһַܱתΪ֣ô parseFloat() ᷵ NaN
ʾֵֻ֣ʹ parseInt() 
ʵ
 1
ڱУǽʹ parseFloat() ַͬ
<script type="text/javascript">

document.write(parseFloat("10")) 
document.write(parseFloat("10.00")) 
document.write(parseFloat("10.33")) 
document.write(parseFloat("34 45 66")) 
document.write(parseFloat(" 60 ")) 
document.write(parseFloat("40 years"))
document.write(parseFloat("He was 40"))

</script>

10
10
10.33
34
60
40
NaN
һ
 2
Ӷ 3.14
<script type="text/javascript">

document.write(parseFloat("3.14")) 
document.write(parseFloat("314e-2")) 
document.write(parseFloat("0.0314E+2")) 
document.write(parseFloat("3.14more non-digit characters")) 

</script>

3.14
һ
 3
ӽ NaN
<script type="text/javascript">

document.write(parseFloat("FF2")) 

</script>

NaN
һ
JavaScript ȫֶοֲ217һַһ()          ȡȡһַһ


÷
parseInt() ɽһַһ
﷨
parseInt(string, radix)
	
string	衣Ҫַ
radix	
ѡʾҪֵĻֵ 2 ~ 36 ֮䡣
ʡԸòֵΪ 0ֽ 10 Ϊ 0x  0X ͷ 16 Ϊ
òС 2 ߴ 36 parseInt()  NaN
ֵ
ؽ֡
˵
 radix ֵΪ 0ûøòʱparseInt()  string жֵĻ
 string  "0x" ͷparseInt()  string ಿֽΪʮƵ string  0 ͷô ECMAScript v3  parseInt() һʵְַΪ˽ƻʮƵ֡ string  1 ~ 9 ֿͷparseInt() ΪʮƵ
ʾע
עַֻͣеĵһֻᱻء
עͣͷͽβĿոġ
ʾַĵһַܱתΪ֣ô parseFloat() ᷵ NaN
ʵ
ڱУǽʹ parseInt() ַͬ
parseInt("10");			// 10
parseInt("19",10);		// 19 (10+9)
parseInt("11",2);		// 3 (2+1)
parseInt("17",8);		// 15 (8+7)
parseInt("1f",16);		// 31 (16+15)
parseInt("010");		//δ 10  8
TIY
parseInt()
ʹ parseInt() ַͬ
JavaScript ȫֶοֲ

йת֪ʶĶ JavaScript ߼̳еݣ
ECMAScript ת217ѶֵתΪַ()                󴮡󴮡ѶֵתΪַ


÷
String() ѶֵתΪַ
﷨
String(object)
	
object	衣JavaScript 
ʵ
ڱУǽ԰ѲͬĶתΪַ
<script type="text/javascript">

var test1= new Boolean(1);
var test2= new Boolean(0);
var test3= new Boolean(true);
var test4= new Boolean(false);
var test5= new Date();
var test6= new String("999 888");
var test7=12345;

document.write(String(test1)+ "<br />");
document.write(String(test2)+ "<br />");
document.write(String(test3)+ "<br />");
document.write(String(test4)+ "<br />");
document.write(String(test5)+ "<br />");
document.write(String(test6)+ "<br />");
document.write(String(test7)+ "<br />");

</script>

true
false
true
false
Wed Oct 28 00:17:40 UTC+0800 2009
999 888
12345
TIY
String()
ʹ String() ѶֵתΪַ217 escape() ַн()    ⴮⴮ escape() ַн롣


÷
unescape() ɶͨ escape() ַн롣
﷨
unescape(string)
	
string	衣Ҫתַ
ֵ
string һ
˵
úĹԭģͨҵʽΪ %xx  %uxxxx ַУx ʾʮƵ֣ Unicode ַ \u00xx  \uxxxx 滻ַнн롣
ʾע
עͣECMAScript v3 Ѵӱ׼ɾ unescape() ʹӦ decodeURI()  decodeURIComponent() ȡ֮
ʵ
ڱУǽʹ escape() ַȻʹ unescape() 룺
<script type="text/javascript">

var test1="Visit W3School!"

test1=escape(test1)
document.write (test1 + "<br />")

test1=unescape(test1)
document.write(test1 + "<br />")

</script>

Visit%20W3School%21
Visit W3School!
TIY
unescape()
ʹ unescape() ַ-1237ڡڡWindow 
Window ʾд򿪵Ĵڡ
ĵܣframe  iframe ǩΪ HTML ĵһ window 󣬲Ϊÿܴһ window 
עͣûӦ window Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.



Window 
Window ʾһڻһܡڿͻ JavaScript УWindow ȫֶеıʽڵǰĻм㡣Ҳ˵ҪõǰڸҪ﷨԰ǸڵΪȫֱʹá磬ֻд documentд window.document
ͬ԰ѵǰڶķʹãֻд alert()д Window.alert()
гԺͷWindow ʵ˺ JavaScript ȫԺͷ
Window  window Ժ self õĶԼȷõǰڣʽʱʹԡ֮⣬parent ԡtop Լ frame[] 鶼뵱ǰ Window ص Window 
Ҫôеһܣʹ﷨
frame[i]		//ǰڵĿ
self.frame[i]	//ǰڵĿ
w.frame[i]	// w Ŀ
Ҫһܵĸڣ򸸿ܣʹ﷨
parent		//ǰڵĸ
self.parent	//ǰڵĸ
w.parent 		// w ĸ
ҪӶ㴰ںеκһʹ﷨
top		//ǰܵĶ㴰
self.top		//ǰܵĶ㴰
f.top		// f Ķ㴰
µĶɷ Window.open() ø÷ʱӦ open() õķֵ洢һУȻʹǸ´ڡ´ڵ opener Է˴Ǹڡ
һ˵Window ķǶڻܽĳֲ alert() confirm()  prompt ͬͨ򵥵ĶԻûн238شĿܣܼ飩ܼܼشĿܡ
ü Window 飬ÿ Window ڴкһܻ <iframe> frames.length  frames[] кеԪظע⣬frames[] õĿܻܿܣԼҲ frames[] 顣



ܣframes[]ǴĿɵ顣ÿԪضһWindow󣬶Ӧڴеһܡ

 

﷨window.frames

 

ÿĿܶframes[]еԪء

 

ifr һԴڵ iframe  ID  NAME ֵ: ȡiframeķУ

document.getElementById(ifr);

window.frames[ifr];

 

Ҫʹiframeڵĺ,ͱͨڶַ.ΪȡһDOMģ͵һַֻȡһOBJECT.

ֻıiframe src  border , scrolling  attributes(propertyһ,propertyǲдڱǩڵ,:scrollHeight,innerHTML),Ҫõһַ.

ȡiframeҳ(iframe),Ҫʹõڶַ,ΪȡõһDOMģ,õiframedocument.body,ֻõڶַ.

Ҫע,iframeҳδȫװʱ,iframeDOMģ,ᷢصĴ,,Ҫ׼һݴģʽ.

 

frames.lengthԴframes[]ĳȡ

עframes[]Ԫڲпܣframes[i]Լframes[]顣

ʵ1⵱ǰҳпܸ

룺

<script type="text/javascript">
document.write( "ܸ"+window.frames.length );
</script>

δЧΪܸ1

עҳаһ<iframe>Ŀܡ238شǷѱر                    رաرաشǷѱرա



÷
closed Կɷһֵֵ˴ǷѾرաΪֻ
ڹرʱʾôڵ Windows 󲢲ʧڣ closed ԽΪ true
﷨
window.closed
ʵ
ӿɼ´Ƿѱرգ
<html>
<head>
<script type="text/javascript">
function ifClosed()
  {
  document.write("'myWindow' has been closed!")
  }
  
function ifNotClosed()
  {
  document.write("'myWindow' has not been closed!")
  }

function checkWin()
  {
  if (myWindow.closed)
    ifClosed()
  else
    ifNotClosed()
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="Has 'myWindow' been closed?"
onclick="checkWin()">

</body>
</html>
TIY
ⴰǷѹرա238û򷵻ش״̬еĬı        û򷵻ش״̬еĬı


÷
defaultStatus Կû򷵻ش״̬еĬıԿɶд
ıҳʱʾ
﷨
window.defaultStatus=sometext
ʵ
ӽ״̬ı
<html>
<body>

<script type="text/javascript">
window.defaultStatus="This is the default text in the status bar!!";
</script>

<p>Look at the text in the statusbar.</p>

</body>
</html>
TIY
״̬Ĭϵı238 Document ֻ              ĵĵ Document ֻáDocument 



Document 
ÿ HTML ĵΪ Document 
Document ʹǿԴӽűж HTML ҳеԪؽзʡ
ʾDocument  Window һ֣ͨ window.document Զзʡ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.


Document 
HTMLDocument ӿڶ DOM Document ӿڽչ HTML רõԺͷ
ܶԺͷ HTMLCollection ʵǿֻ飩б˶êԼɽűԪصá
ЩԶԴ 0  DOMѾ Document.getElementsByTagName() ȡȻʹãΪǺܷ㡣
write() ֵע⣬ĵͽʱһűĵв붯̬ɵݡ
ע⣬ 1  DOM УHTMLDocument һΪ getElementById() ķǳõķ 2  DOM У÷ѾתƵ Document ӿڣ HTMLDocument ̳жˡ238Historyֻ뿴History  ʷʷ History ֻá History 



History 
History ûУʹ URL
History  window һ֣ͨ window.history Զзʡ
עͣûӦ History Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.


History 
History ʾڵʷ˽ԭHistory űѾʹʵ URLΨһʹõĹֻ back()forward()  go() 

һдִеĲ뵥˰ťִеĲһ
history.back()
һдִеĲ뵥κ˰ťִеĲһ
history.go(-2)238شڵĵʾĸ߶              ߡߡشڵĵʾĸ߶ȡ



÷
ֻԣ˴ڵĵʾĸ߶ȺͿȣؼơ
ĿȺ͸߶Ȳ˵Լȵĸ߶ȡ
IE ֧Щԡ document.documentElement  document.body  IE İ汾أ clientWidth  clientHeight Ϊ238شڵĵʾĿ              شڵĵʾĿȡ




÷
ֻԣ˴ڵĵʾĸ߶ȺͿȣؼơ
ĿȺ͸߶Ȳ˵Լȵĸ߶ȡ
IE ֧Щԡ document.documentElement  document.body  IE İ汾أ clientWidth  clientHeight Ϊ238û򷵻شеĿ              û򷵻شеĿ238ڻܵLocation뿴LocationêϢêϢڴڻܵ Location Location 



Location 
Location йصǰ URL Ϣ
Location  Window һ֣ͨ window.location ʡ

ûһµĵַ
IE: Internet Explorer, F: Firefox, O: Opera.



Location 
Location 洢 Window  Location УʾǸеǰʾĵ Web ַ href Դŵĵ URLֱ URL ĸ֡Щ Anchor 󣨻 Area 󣩵 URL Էǳơһ Location תַhref Եֵءζʹñʽ location  location.href
 Anchor ʾĵеĳӣLocation ʾȴǰʾĵ URLλã Location ԶԶֹЩܿʾĵλáһ URL ַ Location  href ԣͻµ URL ָĵװؽʾ
 location  location.href  URL 滻ǰ URL ֮⣬޸Ĳ URLֻҪ Location Ըֵɡͻᴴµ URLеһԭ URL ͬὫװزʾ磬Location hash ԣôͻתƵǰĵеһָλáͬ search ԣôͻװظµĲѯַ URL
 URL ⣬Location  reload() װصǰĵreplace() װһĵΪһµʷ¼Ҳ˵ʷбУĵ滻ǰĵ238û򷵻شڵ                    ơơû򷵻شڵơ



÷
name Կû򷵻شŴڵƵһַ
 open() ʱָĻʹһ <frame> ǵ name ָġ
ڵƿһ <a>  <form> ǵ target Եֵַʽʹ target ˳ĵύӦʾָĴڻС
﷨
window.name=name
ʵ
ӿɷ´ڵƣ
<html>
<head>
<script type="text/javascript">
function checkWin()
  {
  document.write(myWindow.name)
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','MyName','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="What's the name of 'myWindow'?"
onclick="checkWin()">

</body>
</html>
TIY
´ڵơ238Navigatorֻÿ    Navigator ֻáNavigator 

Navigator 
Navigator йϢ
עͣûӦ navigator Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.

Navigator 
Navigator ʹõʹЩԽƽ̨רõá
ȻԶ׼ Netscape  Navigator ʵ JavaScript Ҳ֧
Navigator ʵΨһģ Window  navigator 238ضԴ˴ڵĴڵ            ĸĸضԴ˴ڵĴڵá



÷
opener һɶдԣɷضԴôڵ Window á
opener ԷǳãĴڿôĴԺͺ
﷨
window.opener
ʾע
עֻͣбʾ㴰ڵ Window  operner ԲЧʾܵ Window  operner Ч
ʵ
ӿ opener дıڣ
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','MyName','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
myWindow.opener.document.write("This is the parent window")
</script>

</body>
</html>
TIY
 opener дı238شڵⲿ߶                      ߡߡشڵⲿ߶ȡ



÷
outerheight һֻڵĸ߶ȡ
﷨
window.outerheight=pixels
ʾע
ʾIE ִ֧ԣûṩԡ
ʵ
ӿɰ´Ϊ 100x100 أ
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','')
myWindow.outerheight="100"
myWindow.outerwidth="100"
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>

</body>
</html>
TIY
ôڵĸ߶ȺͿȡ238شڵⲿ                      شڵⲿȡ



÷
outerwidth һֻڵĿȡ
﷨
window.outerwidth=pixels
ʾע
ʾIE ִ֧ԣûṩԡ
ʵ
ӿɰ´Ϊ 100x100 أ
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','')
myWindow.outerheight="100"
myWindow.outerwidth="100"
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>

</body>
</html>
TIY
ôڵĸ߶ȺͿȡ238򷵻صǰҳԴʾϽXλ ҳXҳXû򷵻صǰҳڴʾϽǵ X λá238򷵻صǰҳԴʾϽYλ ҳYҳYû򷵻صǰҳڴʾϽǵ Y λá238ظ                              ظڡ238Screenֻ뿴Screen    ĻĻ Screen ֻá Screen 


Screen 
Screen йؿͻʾĻϢ
עͣûӦ screen Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.




Screen 
ÿ Window  screen Զһ Screen Screen дйʾĻϢJavaScript ЩϢŻǵԴﵽûʾҪ磬һԸʾĳߴѡʹôͼʹСͼԸʾɫѡʹ 16 λɫʹ 8 λɫͼΡ⣬JavaScript ܸйĻߴϢµڶλĻм䡣238ضԵǰڵõȼWindow    ԼԼضԵǰڵáȼ Window ԡ



÷
self ԿɷضԴֻáȼ Window ԡ
﷨
window.self
ʵ
ӴǷһУǣܣ
<html>
<head>
<script type="text/javascript">
function breakout()
  {
  if (window.top!=window.self) 
    {
    window.top.location="tryjs_breakout.htm"
    }
  }
</script>
</head>
<body>

<input type="button" onclick="breakout()"
value="Break out of frame!">

</body>
</html>
TIY

HTML DOM Window οֲ238ô״̬ı                    ״̬״̬ô״̬ı




÷
status Կû򷵻ش״̬еı
﷨
window.status=sometext
˵
status һɶдַҪڴ״̬ʾһϢͨʾϢʱ޵ģֱϢǣûƶڵΪֹ status Ϣʱ״̬ҪôָΪĬϵĿհ״̬Ҫôٴʾ defaultStatus ĬϢ
֪Ѿر˽űǵ״̬Ĺܡһȫʩֹ˳Ŀĵĵ㹥
ʵ
ӽ״̬ı
<html>
<body>

<script type="text/javascript">
window.status="Some text in the status bar!!"
</script>

</body>
</html>
TIY
ڴڵ״̬ı
HTML DOM Window οֲ238ȱ                    ȱڡ



÷
top Էȱڡ
Էضһڵֻáڱһڣtop ԴŶԴáһܣô top ðܵĶ㴰ڡ
﷨
window.top
ʵ
ӴǷһУǣܣ
<html>
<head>
<script type="text/javascript">
function breakout()
{
if (window.top!=window.self) 
{
window.top.location="tryjs_breakout.htm"
}
}
</script>
</head>

<body>
<form>
Click the button to break out of the frame:
<input type="button" onclick="breakout()" value="Break out!">
</form>
</body>

</html>
һ
TIY

ڵĳߴ
ѴڵΪָĳߴ238Եȼself԰Դ  ڡڡwindow Եȼ self ԣ˶Դá238ֻϽĻxy  ֻ˴ڵϽĻϵĵ x  y ꡣIESafari  Opera ֧ screenLeft  screenTop Firefox  Safari ֧ screenX  screenY238ֻϽĻxy  궥궥ֻ˴ڵϽĻϵĵ x  y ꡣIESafari  Opera ֧ screenLeft  screenTop Firefox  Safari ֧ screenX  screenY238ֻϽĻxy  XXֻ˴ڵϽĻϵĵ x  y ꡣIESafari  Opera ֧ screenLeft  screenTop Firefox  Safari ֧ screenX  screenY238ֻϽĻxy  YYֻ˴ڵϽĻϵĵ x  y ꡣIESafari  Opera ֧ screenLeft  screenTop Firefox  Safari ֧ screenX  screenY238ʾһϢһȷϰťľ()ʾһϢһȷϰťľ




÷
alert() ʾһָϢһ OK ťľ
﷨
alert(message)
	
message	Ҫ window ϵĶԻʾĴı HTML ı
ʵ
<html>
<head>
<script type="text/javascript">
function display_alert()
  {
  alert("I am an alert box!!")
  }
</script>
</head>
<body>

<input type="button" onclick="display_alert()"
value="Display alert box" />

</body>
</html>
TIY
ʾһԻ
ʾеĶԻ238Ѽ̽Ӷ㴰ƿ()              ƽƽѼ̽Ӷ㴰ƿ



÷
blur() ɰѼ̽Ӷ㴰ƿ
﷨
window.blur()
˵
 blur() ɰѼ̽Ӷߣ Window ָĸջü̽㲢ûָ
ʾע
עͣĳЩϣ÷Ч
ʵ
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.blur()
</script>

</body>
</html>
TIY
ѽƵ´
´ƿ238ȡ()õ()              ڡڡȡ setInterval() õ timeout




÷
clearInterval() ȡ setInterval() õ timeout
clearInterval() Ĳ setInterval() ص ID ֵ
﷨
clearInterval(id_of_setinterval)
	
id_of_setinterval	 setInterval() ص ID ֵ
ʵ
ӽÿ 50  clock() Ҳʹһťֹͣ clock
<html>
<body>

<input type="text" id="clock" size="35" />
<script language=javascript>
var int=self.setInterval("clock()",50)
function clock()
  {
  var t=new Date()
  document.getElementById("clock").value=t
  }
</script>
</form>
<button onclick="int=window.clearInterval(int)">
Stop interval</button>

</body>
</html>
TIY
ʹ setInterval()  clearInterval()238ȡʱõʱ()            ʱʱȡ setTimeout() õ timeout





÷
clearTimeout() ȡ setTimeout() õ timeout
﷨
clearTimeout(id_of_settimeout)
	
id_of_settimeout	 setTimeout() ص ID ֵֵʶҪȡӳִд顣
ʵ
ÿһ timedCount() ҲʹһťֹʱϢ
<html>
<head>
<script type="text/javascript">
var c=0
var t
function timedCount()
  {
  document.getElementById('txt').value=c
  c=c+1
  t=setTimeout("timedCount()",1000)
  }
function stopCount()
  {
  clearTimeout(t)
  }
</script>
</head>
<body>

<form>
<input type="button" value="Start count!" onClick="timedCount()">
<input type="text" id="txt">
<input type="button" value="Stop count!" onClick="stopCount()">
</form>

</body>
</html>
TIY
ֹͣťļʱ238ر()                        ششرڡ




÷
close() ڹرڡ
﷨
window.close()
˵
 close() ر window ָĶڡĳڿͨ self.close() ֻ close() ر
ֻͨ JavaScript 򿪵Ĵڲܹ JavaScript رաֹ˶Ľűֹû
ʵ
ӿɹرµ
<html>
<head>
<script type="text/javascript">
function closeWin()
  {
  myWindow.close()
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="Close 'myWindow'"
onclick="closeWin()" />

</body>
</html>
TIY
ڵťʱر238ϢԼȷϺȡťĶԻ()    ԻԻʾһϢԼȷϰťȡťĶԻ




÷
confirm() ʾһָϢ OK ȡťĶԻ
﷨
confirm(message)
	
message	Ҫ window ϵĶԻʾĴı HTML ı
˵
ûȷť confirm()  trueȡť confirm()  false
ûȷťȡťѶԻر֮ǰֹû롣ڵ confirm() ʱͣ JavaScript ִУûӦ֮ǰִһ䡣
ʾע
ʾԻťǲɸıģСĵرдϢʹʺȷϺȡش
ʵ
<html>
<head>
<script type="text/javascript">
function disp_confirm()
  {
  var r=confirm("Press a button")
  if (r==true)
    {
    document.write("You pressed OK!")
    }
  else
    {
    document.write("You pressed Cancel!")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="disp_confirm()"
value="Display a confirm box" />

</body>
</html>
TIY
ʾһȷϿ238һ pop-up ()                  һ pop-up ڡ




÷
createPopup() ڴһ pop-up ڡ
﷨
window.createPopup()
ʵ
<html>
<head>
<script type="text/javascript">
function show_popup()
{
var p=window.createPopup()
var pbody=p.document.body
pbody.style.backgroundColor="lime"
pbody.style.border="solid black 1px"
pbody.innerHTML="This is a pop-up! Click outside to close."
p.show(150,150,200,50,document.body)
}
</script>
</head>

<body>
<button onclick="show_popup()">Create pop-up!</button>
</body>

</html>
TIY
 pop-up238Ѽ̽һ()                Ѽ̽һڡ



÷
focus() ɰѼ̽һڡ
﷨
window.focus()
ʵ
ӿȷµĴڵõ㣺
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>

</body>
</html>
TIY
ѽ´
´ƿ238Դڵǰƶָ()    ơơԴڵĵǰƶָء



÷
moveBy() Դڵĵǰƶָء
﷨
window.moveBy(x,y)
	
x	ҪѴƵ
y	ҪѴƵ
ʵ
ӽѴ䵱ǰλƶ 50 أ
<html>
<head>
<script type="text/javascript">
function moveWin()
  {
  myWindow.moveBy(50,50)
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="Move 'myWindow'"
onclick="moveWin()" />

</body>
</html>
TIY
ͨ moveBy() ƶڡ238ѴڵϽƶһָ()      ѴڵϽƶһָꡣ



÷
moveTo() ɰѴڵϽƶһָꡣ
﷨
window.moveTo(x,y)
	
x	λõ x 
y	λõ y 
ʾע
עͣڰȫԭƴ˷ʹ䲻ܰѴƳĻ
ʵ
ӽ´ƶָ꣺
<html>
<head>
<script type="text/javascript">
function moveWin()
  {
  myWindow.moveTo(50,50)
  }
</script>
</head>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
</script>

<input type="button" value="Move 'myWindow'"
onclick="moveWin()" />

</body>
</html>
TIY
ͨ moveTo() ƶ


238ڻ()      һµڻһĴڡ



÷
open() ڴһµڻһĴڡ
﷨
window.open(URL,name,features,replace)
	
URL	һѡַҪ´ʾĵ URLʡֵǿַô´ھͲʾκĵ
name	һѡַַһɶŷָба֡ĸ»ߣַ´ڵơƿ <a>  <form>  target ֵòָһѾڵĴڣô open() Ͳٴһ´ڣֻǷضָڵá£features ԡ
features	һѡַ´Ҫʾı׼ʡԸò´ڽб׼ڴУǶԸַĸʽϸ˵
replace
һѡĲֵ涨װصڵ URL ڴڵʷдһĿ滻ʷеĵǰĿֵ֧
true - URL 滻ʷеĵǰĿ
false - URL ʷдµĿ
ʾע
Ҫ벻Ҫ Window.open() 뷽 Document.open()ߵĹȫͬΪʹĴףʹ Window.open()Ҫʹ open()
ʵ 1
ӽд www.w3school.com.cn 
<html>
<head>
<script type="text/javascript">
function open_win() 
{
window.open("http://www.w3school.com.cn")
}
</script>
</head>
<body>

<input type=button value="Open Window" onclick="open_win()" />

</body>
</html>
ʵ 2
ӽд about:blank ҳ
<html>
<body>

<script type="text/javascript">
myWindow=window.open('','','width=200,height=100')
myWindow.document.write("This is 'myWindow'")
myWindow.focus()
</script>

</body>
</html>
TIY
ͨťһ
һ´ڣ
ͨһε򿪶
һ´
Window Features
channelmode=yes|no|1|0	ǷʹþԺģʽʾڡĬΪ no
directories=yes|no|1|0	ǷĿ¼ťĬΪ yes
fullscreen=yes|no|1|0	ǷʹȫģʽʾĬ noȫģʽĴڱͬʱھԺģʽ
height=pixels	ĵʾĸ߶ȡؼơ
left=pixels	ڵ x ꡣؼơ
location=yes|no|1|0	ǷʾֶַΡĬ yes
menubar=yes|no|1|0	Ƿʾ˵Ĭ yes
resizable=yes|no|1|0	Ƿɵڳߴ硣Ĭ yes
scrollbars=yes|no|1|0	ǷʾĬ yes
status=yes|no|1|0	Ƿ״̬Ĭ yes
titlebar=yes|no|1|0	ǷʾĬ yes
toolbar=yes|no|1|0	ǷʾĹĬ yes
top=pixels	ڵ y ꡣ
width=pixels	ڵĵʾĿȡؼơ
275ǷʹþԺģʽʾڡĬΪ no   channelmode=yes|nochannelmode=yes|noǷʹþԺģʽʾڡĬΪ no

channelmode=yes|no275ǷĿ¼ťĬΪ yes          directories=yes|nodirectories=yes|noǷĿ¼ťĬΪ yes275ǷʹȫģʽʾĬ noȫģʽĴڱͬʱھԺģʽfullscreen=yes|nofullscreen=yes|noǷʹȫģʽʾĬ noȫģʽĴڱͬʱھԺģʽ275ĵʾĸ߶ȡؼơ        height=pixelsheight=pixelsĵʾĸ߶ȡؼơ275ڵ x ꡣؼơ               left=pixelsleft=pixelsڵ x ꡣؼơ275ǷʾֶַΡĬ yes          location=yes|no|1|0location=yes|no|1|0ǷʾֶַΡĬ yes275Ƿʾ˵Ĭ yes            menubar=yes|no|1|0menubar=yes|no|1|0Ƿʾ˵Ĭ yes275Ƿɵڳߴ硣Ĭ yes        resizable=yes|no|1|0resizable=yes|no|1|0Ƿɵڳߴ硣Ĭ yes275ǷʾĬ yes            scrollbars=yes|no|1|0scrollbars=yes|no|1|0ǷʾĬ yes275Ƿ״̬Ĭ yes            status=yes|no|1|0status=yes|no|1|0Ƿ״̬Ĭ yes275ǷʾĬ yes            titlebar=yes|no|1|0titlebar=yes|no|1|0ǷʾĬ yes275ǷʾĹĬ yes    toolbar=yes|no|1|0toolbar=yes|no|1|0ǷʾĹĬ yes275ڵ y ꡣ                         top=pixelstop=pixelsڵ y ꡣ275ڵĵʾĿȡؼơ      width=pixelswidth=pixelsڵĵʾĿȡؼơ238ӡǰڵ()                    ӡӡӡǰڵݡ


÷
print() ڴӡǰڵݡ
 print() ΪûĴӡťͨһԻûȡƴӡ
﷨
window.print()
ʵ 1
<html>
<head>
<script type="text/javascript">
function printpage()
  {
  window.print()
  }
</script>
</head>
<body>

<input type="button" value="Print this page"
onclick="printpage()" />

</body>
</html>
TIY
ӡҳ238ʾʾûĶԻ()            ʾʾûĶԻ



÷
prompt() ʾʾûĶԻ
﷨
prompt(text,defaultText)
	
text	ѡҪڶԻʾĴı HTML ʽı
defaultText	ѡĬϵı
˵
ûʾȡť򷵻 nullûȷϰť򷵻ֶεǰʾı
ûȷťȡťѶԻر֮ǰֹû롣ڵ prompt() ʱͣ JavaScript ִУûӦ֮ǰִһ䡣
ʵ 1
<html>
<head>
<script type="text/javascript">
function disp_prompt()
  {
  var name=prompt("Please enter your name","")
  if (name!=null && name!="")
    {
    document.write("Hello " + name + "!")
    }
  }
</script>
</head>
<body>

<input type="button" onclick="disp_prompt()"
value="Display a prompt box" />

</body>
</html>
TIY
ʾʾ238ָصڵĴС()          ССָصڵĴС



÷
resizeBy() ڸָڵĴС
﷨
resizeBy(width,height)
	
width	衣Ҫʹڿӵֵ
height	ѡҪʹڸ߶ӵֵ
ʵ 1
<html>
<head>
<script type="text/javascript">
function resizeWindow()
  {
  window.resizeBy(-100,-100)
  }
</script>
</head>
<body>

<input type="button" onclick="resizeWindow()"
value="Resize window">

</body>
</html>
TIY
ڵĴС238ѴڵĴСָĿȺ͸߶()    ߡߡѴڵĴСָĿȺ͸߶ȡ



÷
resizeTo() ڰѴڴСΪָĿȺ͸߶ȡ
﷨
resizeTo(width,height)
	
width	衣ҪĴڵĿȡؼơ
height	ѡҪĴڵĸ߶ȡؼơ
ʵ
<html>
<head>
<script type="text/javascript">
function resizeWindow()
  {
  window.resizeTo(500,300)
  }
</script>
</head>
<body>

<input type="button" onclick="resizeWindow()"
value="Resize window">

</body>
</html>
TIY
ѴڵΪָĴС238ֵָ()            ֵָݡ




÷
scrollBy() ɰݹָ
﷨
scrollBy(xnum,ynum)
	
xnum	衣ĵҹ
ynum	衣ĵ¹
ʵ
ӿɰݹ 100 أ
<html>
<head>
<script type="text/javascript">
function scrollWindow()
  {
  window.scrollBy(100,100)
  }
</script>
</head>
<body>

<input type="button" onclick="scrollWindow()" value="Scroll" />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>

</body>
</html>
TIY
ͨ scrollBy() ĵ238ݹָ()                ݹָꡣ




÷
scrollTo() ɰݹָꡣ
﷨
scrollTo(xpos,ypos)
	
xpos	衣ҪڴĵʾϽʾĵ x ꡣ
ypos	衣ҪڴĵʾϽʾĵ y ꡣ
ʵ
ӿɰݹλ 100,500
<html>
<head>
<script type="text/javascript">
function scrollWindow()
  {
  window.scrollTo(100,500)
  }
</script>
</head>
<body>

<input type="button" onclick="scrollWindow()" value="Scroll" />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<p>SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL SCROLL</p>

</body>
</html>
TIY
ͨ scrollTo() Ѵڹָλá238ָ()úʽ()  ڡڡָڣԺƣúʽ




÷
setInterval() ɰָڣԺƣúʽ
setInterval() ᲻ͣصúֱ clearInterval() û򴰿ڱرա setInterval() ص ID ֵ clearInterval() Ĳ
﷨
setInterval(code,millisec[,"lang"])
	
code	衣ҪõĺҪִеĴ봮
millisec	롣ִл code ֮ʱԺơ
ֵ
һԴݸ Window.clearInterval() Ӷȡ code ִеֵ
ʵ
<html>
<body>

<input type="text" id="clock" size="35" />
<script language=javascript>
var int=self.setInterval("clock()",50)
function clock()
  {
  var t=new Date()
  document.getElementById("clock").value=t
  }
</script>
</form>
<button onclick="int=window.clearInterval(int)">
Stop interval</button>

</body>
</html>
TIY
ʹ setInterval()  clearInterval()238ָúʽ()        ʱʱָĺúʽ




÷
setTimeout() ָĺúʽ
﷨
setTimeout(code,millisec)
	
code	衣ҪõĺҪִе JavaScript 봮
millisec	衣ִдǰȴĺ
ʾע
ʾsetTimeout() ִֻ code һΡҪεãʹ setInterval()  code ٴε setTimeout()
ʵ
<html>
<head>
<script type="text/javascript">
function timedMsg()
{
var t=setTimeout("alert('5 seconds!')",5000)
}
</script>
</head>

<body>
<form>
<input type="button" value="Display timed alertbox!"
onClick="timedMsg()">
</form>
<p>Click on the button above. An alert box will be
displayed after 5 seconds.</p>
</body>

</html>
TIY
򵥵ļʱ
һ򵥵ļʱ
ѭеļʱ
ѭеļʱ - һֹͣť
һʱӡ237Navigator 
Navigator йϢ
עͣûӦ navigator Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.



Navigator 
Navigator ʹõʹЩԽƽ̨רõá
ȻԶ׼ Netscape  Navigator ʵ JavaScript Ҳ֧
Navigator ʵΨһģ Window  navigator 298ضĵǶʽãһ Plugin 飩Ƕ뼯Ƕ뼯
ضĵǶʽá
üһ Plugin 飬еԪشѾװĲPlug-in ṩйزϢаֵ֧ MIME ͵б
Ȼ plugins[]  IE 4 ģ IE 4 ȴǿյģΪ IE 4 ֲ֧ Plugin 
	298Ĵ                      Ĵ



÷
appCodeName һַֻĴ
 Netscape ΪУֵ "Mozilla"Ϊ˼ Microsoft УֵҲ "Mozilla"
﷨
navigator.appCodeName
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>CodeName: ")
document.write(navigator.appCodeName + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298Ĵμ汾                    ΰ汾ΰ汾Ĵμ汾




÷
appMinorVersion ԿɷĴҪ汾
﷨
navigator.appMinorVersion
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>MinorVersion: ")
document.write(navigator.appMinorVersion + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298                        ơ




÷
appName Կɷơ
appName һַֻơڻ Netscape УԵֵ "Netscape" IE УԵֵ "Microsoft Internet Explorer"ȷرʾԼαװԴﵽԡ
﷨
navigator.appMinorVersion
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Name: ")
document.write(navigator.appName + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298ƽ̨Ͱ汾Ϣ              ƽ̨ƽ̨ƽ̨Ͱ汾Ϣ



appVersion Կɷƽ̨Ͱ汾Ϣһַֻ
ַĵһǰ汾šѸַݸ parseInt() ֻܻȡ汾šԵಿṩй汾ϸڣĲϵͳϢ
﷨
navigator.appVersion
ʾע
עͣͬṩϢĸʽǲͬġ
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Version: ")
document.write(navigator.appVersion + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298صǰ                    صǰԡ




÷
browserLanguage Կɷصǰԡ
﷨
navigator.browserLanguage
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>BrowserLanguage: ")
document.write(navigator.browserLanguage + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298ָǷcookieĲֵ  ʶʶָǷ cookie Ĳֵ



÷
cookieEnabled Կɷһֵ cookieֵΪ true cookieֵΪ false
﷨
navigator.cookieEnabled
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>CookieEnabled: ")
document.write(navigator.cookieEnabled + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298ϵͳ CPU ȼ               CPUȼCPUȼϵͳ CPU ȼ


÷
cpuClass Կɷϵͳ CPU ȼ
﷨
navigator.cpuClassd
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>CPUClass: ")
document.write(navigator.cpuClass + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸ
û298ָϵͳǷѻģʽĲֵ    ָϵͳǷѻģʽĲֵ



÷
onLine һֻĲֵϵͳǷѻģʽ
עͣ IE 4+ Уûѡѻ״̬ѻѡϵͳͽѻ״̬ݽӻжȡ
﷨
navigator.onLine
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>OnLine: ")
document.write(navigator.onLine + "</p>")
</script>
</body>

</html>
TIY
ߵͰ汾
йطߵĸϢ
йطߵȫϸڡ298Ĳϵͳƽ̨            ϵͳϵͳĲϵͳƽ̨



÷
platform һַֻĲϵͳͣӲƽ̨
Ȼûб׼ֵϣЩֵ "Win32""MacPPC" Լ "Linuxi586"ȵȡ
﷨
navigator.platform
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Platform: ")
document.write(navigator.platform + "</p>")
</script>
</body>

</html>298OSʹõĬ                    ϵͳԡϵͳԡ OS ʹõĬԡ




÷
systemLanguage ԿɷزϵͳʹõĬԡ
﷨
navigator.systemLanguage
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>SystemLanguage: ")
document.write(navigator.systemLanguage + "</p>")
</script>
</body>

</html>298ؿͻͷuser-agentͷֵ  ͷͷɿͻͷ user-agent ͷֵ



÷
userAgent һַֻ HTTP ûͷֵ
һ navigator.appCodeName ֵ֮бߺ navigator.appVersion ֵɵġ
磺Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
עûͷuser-agent header
﷨
navigator.userAgent
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>UserAgent: ")
document.write(navigator.userAgent + "</p>")
</script>
</body>

</html>
TIY298 OS Ȼ                  ʹԡʹԡ OS Ȼá



÷
userLanguage ԿɷزϵͳȻá
﷨
navigator.userLanguage
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>UserLanguage: ")
document.write(navigator.userLanguage + "</p>")
</script>
</body>

</html>298涨Ƿ Java()               ɷJavaɷJava涨Ƿ Java



÷
javaEnabled() ɷһֵֵָʾǷֲ֧ Javaǣ򷵻 true򷵻 false
﷨
navigator.javaEnabled()
ʾע
ʾʹ navigator.javaEnabled() ⵱ǰǷ֧ JavaӶ֪Ƿʾ Java С
ʵ
ӽصǰǷ Java Ĳֵ
<html>
<body>

<script type="text/javascript">
alert(navigator.javaEnabled())
</script>

</body>
</html>

true298涨Ƿ۵(data tainting)()   Ƿ۵Ƿ۵涨Ƿ۵ (data tainting)




÷
taintEnabled() ɷһֵֵ˵ǰǷ data tainting
﷨
navigator.taintEnabled()
ʵ
ӽصǰǷ data tainting Ĳֵ
<html>
<body>

<script type="text/javascript">
alert(navigator.taintEnabled())
</script>

</body>
</html>

false237ĻĻScreen 
Screen йؿͻʾĻϢ
עͣûӦ screen Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.




Screen 
ÿ Window  screen Զһ Screen Screen дйʾĻϢJavaScript ЩϢŻǵԴﵽûʾҪ磬һԸʾĳߴѡʹôͼʹСͼԸʾɫѡʹ 16 λɫʹ 8 λɫͼΡ⣬JavaScript ܸйĻߴϢµڶλĻм䡣314سϵͳʾĻĸ߶          ߡߡʾĻĸ߶ ( Windows ֮)




÷
availHeight ʾĻĿø߶ȣؼơ Windows ĲϵͳУø߶ȲԣĻײĴֱռ䡣
﷨
screen.availHeight
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Available Height: ")
document.write(screen.availHeight + "</p>")
</script>
</body>

</html>314سϵͳʾĻĿ          ʾĻĿ ( Windows ֮)




÷
availWidth ʾĻĿÿȣؼơ Windows ĲϵͳУø߶ȲԣĻײĴֱռ䡣
﷨
screen.availWidth
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Available Width: ")
document.write(screen.availWidth + "</p>")
</script>
</body>

</html>314û򷵻صɫı              ɫɫû򷵻صɫıȡ



÷
bufferDepth û򷵻 off-screen bitmap buffer еɫıȡ
﷨
screen.bufferDepth=number
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Buffer Depth: ")
document.write(screen.bufferDepth + "</p>")
</script>
</body>

</html>314Ŀ豸򻺳ϵɫ    豸ɫ豸ɫĿ豸򻺳ϵĵɫıȡ



÷
colorDepth ԷĿ豸򻺳ϵĵɫıȡ
﷨
screen.colorDepth
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Color Depth: ")
document.write(screen.colorDepth + "</p>")
</script>
</body>

</html>
TIY314ʾĻÿӢˮƽ            ӢӢʾĻÿӢˮƽ



÷
deviceXDPI ԷʾĻÿӢˮƽ
﷨
screen.deviceXDPI
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Device XDPI: ")
document.write(screen.deviceXDPI + "</p>")
</script>
</body>

</html>
TIY314ʾĻÿӢ紹ֱ            ӢӢʾĻÿӢ紹ֱ



÷
deviceYDPI ԷʾĻÿӢ紹ֱ
﷨
screen.deviceYDPI
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Device YDPI: ")
document.write(screen.deviceYDPI + "</p>")
</script>
</body>

</html>
TIY
йؿͻĻϸڡ314ûǷʾƽ  ƽƽûǷʾƽ



÷
fontSmoothingEnabled ԷûǷʾƽ
﷨
sscreen.fontSmoothingEnabled
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>FontSmoothingEnabled: ")
document.write(screen.fontSmoothingEnabled + "</p>")
</script>
</body>

</html>314ʾĻĸ߶                      ȫߡȫߡʾĻĸ߶ȡ



÷
height ʾĻĸ߶ȣؼơ
﷨
screen.height
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Height: ")
document.write(screen.height + "</p>")
</script>
</body>

</html>
TIY314ʾĻÿӢˮƽĳ  ᳣᳣ʾĻÿӢˮƽĳ



÷
logicalXDPI ԿɷʾĻÿӢˮƽĳ
﷨
screen.logicalXDPI
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Logical XDPI: ")
document.write(screen.logicalXDPI + "</p>")
</script>
</body>

</html>
TIY314ʾĻÿӢĴֱĳ  ʾĻÿӢĴֱĳ



÷
logicalYDPI ԿɷʾĻÿӢĴֱĳ
﷨
screen.logicalYDPI
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Logical YDPI: ")
document.write(screen.logicalYDPI + "</p>")
</script>
</body>

</html>314ʾĻɫֱʼÿ      ֱʡֱʡʾĻɫֱʣÿأ




÷
pixelDepth ԷʾĻɫֱʣÿأ
﷨
screen.pixelDepth
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Pixel Depth: ")
document.write(screen.pixelDepth + "</p>")
</script>
</body>

</html>314û򷵻Ļˢ                  ˢʡˢʡû򷵻Ļˢʡ



÷
updateInterval Կû򷵻Ļˢʡ
﷨
screen.updateInterval=number
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Update Interval: ")
document.write(screen.updateInterval + "</p>")
</script>
</body>

</html>
TIY314ʾĻĿ                    ȫȫʾĻĿȡ



÷
width ʾĻĿȣؼơ
﷨
screen.width
ʵ
<html>

<body>
<script type="text/javascript">
document.write("<p>Width: ")
document.write(screen.width + "</p>")
</script>
</body>

</html>
TIY237ʷʷHistory 
History ûУʹ URL
History  window һ֣ͨ window.history Զзʡ
עͣûӦ History Ĺ׼ָ֧ö
IE: Internet Explorer, F: Firefox, O: Opera.



History 
History ʾڵʷ˽ԭHistory űѾʹʵ URLΨһʹõĹֻ back()forward()  go() 

һдִеĲ뵥˰ťִеĲһ
history.back()
һдִеĲ뵥κ˰ťִеĲһ
history.go(-2)328ʷбе URL          URLURLʷбе URL 



length ʷбеԪ
עͣIE 6  Opera 9  0 ʼ Firefox 1.5  1 ʼ
﷨
history.length
ʵ
<html>
<body>

<script type="text/javascript">
document.write(history.length);
</script>

</body>
</html>
ƣ
3
TIY
ʹ history  length ԡ328historyбеǰһURL()          ǰǰ history беǰһ URL



÷
back() ɼʷбеǰһ URLڣ
ø÷Чȼڵ˰ť history.go(-1)
﷨
history.back()
ʵ
ӿҳϴһ˰ť
<html>
<head>
<script type="text/javascript">
function goBack()
  {
  window.history.back()
  }
</script>
</head>
<body>

<input type="button" value="Back" onclick="goBack()" />

</body>
</html>328historyбеһ URL()         ¸¸ history беһ URL




÷
forward() ɼʷбеһ URL
ø÷Чȼڵǰť history.go(1)
﷨
history.forward()
ʵ
ӿҳϴһǰť
<html>
<head>
<script type="text/javascript">
function goForward()
  {
  window.history.forward()
  }
</script>
</head>
<body>

<input type="button" value="Forward" onclick="goForward()" />

</body>
</html>328 history беĳҳ()      history беĳҳ档



÷
go() ɼʷбеĳҳ档
﷨
history.go(number|URL)
˵
URL ʹõҪʵ URL URL Ӵ number ʹõҪʵ URL  History  URL беλá
ʵ
ӻʷбеǰһҳ棺
<html>
<head>
<script type="text/javascript">
function goBack()
  {
  window.history.go(-1)
  }
</script>
</head>
<body>

<input type="button" value="Back" onclick="goBack()" />

</body>
</html>237êϢêϢLocation 
Location йصǰ URL Ϣ
Location  Window һ֣ͨ window.location ʡ

ûһµĵַ
IE: Internet Explorer, F: Firefox, O: Opera.




Location 
Location 洢 Window  Location УʾǸеǰʾĵ Web ַ href Դŵĵ URLֱ URL ĸ֡Щ Anchor 󣨻 Area 󣩵 URL Էǳơһ Location תַhref Եֵءζʹñʽ location  location.href
 Anchor ʾĵеĳӣLocation ʾȴǰʾĵ URLλã Location ԶԶֹЩܿʾĵλáһ URL ַ Location  href ԣͻµ URL ָĵװؽʾ
 location  location.href  URL 滻ǰ URL ֮⣬޸Ĳ URLֻҪ Location Ըֵɡͻᴴµ URLеһԭ URL ͬὫװزʾ磬Location hash ԣôͻתƵǰĵеһָλáͬ search ԣôͻװظµĲѯַ URL
 URL ⣬Location  reload() װصǰĵreplace() װһĵΪһµʷ¼Ҳ˵ʷбУĵ滻ǰĵ333û򷵻شӾ(#)ʼURLê        êêû򷵻شӾ (#) ʼ URLê



÷
hash һɶдַַ URL ê֣ # ſʼĲ֣
﷨
location.hash=anchorname
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.hash);
</script>

</body>
</html>

#part2
TIY
ʹ location  hash 
ê
ڡһаĸťڶڶĸêһеĳťʱonclick ¼ᵽڶָê333û򷵻͵ǰURLĶ˿ں       ˿ڡ˿ڡû򷵻͵ǰ URL Ķ˿ںš



÷
host һɶдַû򷵻صǰ URL ƺͶ˿ںš
﷨
location.host
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.host);
</script>

</body>
</html>

example.com:1234
TIY
ʹ location  host ԡ333û򷵻صǰ URL              û򷵻صǰ URL 



÷
hostname һɶдַû򷵻صǰ URL 
﷨
location.hostname
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.hostname);
</script>

</body>
</html>

example.com
TIY
ʹ location  hostname ԡ333û򷵻 URL                    URLURLû򷵻 URL



÷
href һɶдַû򷵻صǰʾĵ URL
ˣǿͨΪµ URLʹȡʾµ URL ݡ
﷨
location.href=URL
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.href);
</script>

</body>
</html>

http://example.com:1234/test.htm#part2
TIY
ʹ location  href ԡ333û򷵻صǰURL·             URL·URL·û򷵻صǰ URL ·֡



÷
pathname һɶдַû򷵻صǰ URL ·֡
﷨
location.pathname=path
ʵ
赱ǰ URL : http://example.com:1234/test/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.pathname);
</script>

</body>
</html>

/test/test.htm
TIY333û򷵻صǰ URL Ķ˿ں             ˿ڡ˿ڡû򷵻صǰ URL Ķ˿ںš



÷
port һɶдַû򷵻صǰ URL Ķ˿ڲ֡
﷨
location.port=portnumber
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.port);
</script>

</body>
</html>

1234
TIY
ʹ location  port ԡ333û򷵻صǰ URL Э               ЭЭû򷵻صǰ URL Э顣



÷
protocol һɶдַû򷵻صǰ URL Э顣
﷨
location.protocol=path
ʵ
赱ǰ URL : http://example.com:1234/test.htm#part2
<html>
<body>

<script type="text/javascript">
document.write(location.protocol);
</script>

</body>
</html>

http:
TIY
ʹ location  protocol ԡ333û򷵻شʺ(?)ʼURLѯ    ѯѯû򷵻شʺ (?) ʼ URLѯ֣



÷
search һɶдַû򷵻صǰ URL Ĳѯ֣ʺ ? ֮Ĳ֣
﷨
location.search=path_from_questionmark
ʵ
赱ǰ URL : http://www.w3school.com.cn/tiy/t.asp?f=hdom_loc_search
<html>
<body>

<script type="text/javascript">
document.write(location.search);
</script>

</body>
</html>

?f=hdom_loc_search
TIY
ʹ location  search ԡ333µĵ()                          ĵĵµĵ



÷
assign() ɼһµĵ
﷨
location.assign(URL)
ʵ
ӽʹ assign() һµĵ
<html>
<head>
<script type="text/javascript">
function newDoc()
  {
  window.location.assign("http://www.w3school.com.cn")
  }
</script>
</head>
<body>

<input type="button" value="Load new document" onclick="newDoc()" />

</body>
</html>
TIY333¼صǰĵ()                      ءء¼صǰĵ



÷
reload() ¼صǰĵ
﷨
location.reload(force)
˵
÷ûй涨߲ falseͻ HTTP ͷ If-Modified-Since ϵĵǷѸı䡣ĵѸı䣬reload() ٴظĵĵδı䣬÷ӻװĵûˢ°ťЧȫһġ
Ѹ÷ĲΪ trueôĵ޸ʲôƹ棬ӷظĵûڵˢ°ťʱס Shift Чȫһ
ʵ
<html>
<head>
<script type="text/javascript">
function reloadPage()
  {
  window.location.reload()
  }
</script>
</head>

<body>
<input type="button" value="Reload page"
onclick="reloadPage()" />
</body>

</html>
TIY
ʹ location  reload() 333µĵ滻ǰĵ()                ءءµĵ滻ǰĵ



÷
replace() һĵȡǰĵ
﷨
location.replace(newURL)
˵
replace()  History һµļ¼ʹø÷ʱµ URL  History еĵǰ¼
ʵ
ӽʹ replace() 滻ǰĵ
<html>
<head>
<script type="text/javascript">
function replaceDoc()
  {
  window.location.replace("http://www.w3school.com.cn")
  }
</script>
</head>
<body>

<input type="button" value="Replace document" onclick="replaceDoc()" />

</body>
</html>
TIY-1HTMLDOMҳ345ĵĵDocument 
ÿ HTML ĵΪ Document 
Document ʹǿԴӽűж HTML ҳеԪؽзʡ
ʾDocument  Window һ֣ͨ window.document Զзʡ



Document 
HTMLDocument ӿڶ DOM Document ӿڽչ HTML רõԺͷ
ܶԺͷ HTMLCollection ʵǿֻ飩б˶êԼɽűԪصá
ЩԶԴ 0  DOMѾ Document.getElementsByTagName() ȡȻʹãΪǺܷ㡣
write() ֵע⣬ĵͽʱһűĵв붯̬ɵݡ
ע⣬ 1  DOM УHTMLDocument һΪ getElementById() ķǳõķ 2  DOM У÷ѾתƵ Document ӿڣ HTMLDocument ̳жˡ346ṩĵHTMLԪصķʣۼϣ  ССṩĵ HTML Ԫصķʡ



÷
all Ϸضĵ HTML Ԫصá
﷨
document.all[i]
document.all[name]
document.all.tags[tagname]
˵
all[] һ๦ܵĶṩ˶ĵ HTML Ԫصķʡall[] Դ IE 4 Ѿܶá
all[] Ѿ Document ӿڵı׼ getElementById()  getElementsByTagName() Լ Document  getElementsByName() ȡˣ all[] еĴȻʹá
all[] Ԫر˳֪еȷֻλãֱӴȡǡȻΪʹ all[] 飬ǵ HTML  name  id ԪءԪӵָ nameõͬһƵԪصһ顣346ضĵAnchorãۼϣݼӡӡضĵ Anchor á



÷
anchors Ͽɷضĵ Anchor á
﷨
document.anchors[]
ʵ
<html>

<body>
<a name="first">First anchor</a><br />
<a name="second">Second anchor</a><br />
<a name="third">Third anchor</a><br />
<br />

Number of anchors in this document:
<script type="text/javascript">
document.write(document.anchors.length)
</script>
</body>

</html>
TIY
ĵêĿ
ĵеһê innerHTML346ضĵAppletãۼϣݼjavajavaضĵ Applet á



346ضĵFormãۼϣ    ضĵ Form á



÷
forms Ͽɷضĵ Form á
﷨
document.forms[]
ʵ
<html>
<body>

<form name="Form1"></form>
<form name="Form2"></form>
<form name="Form3"></form>

<script type="text/javascript">
document.write("This document contains: ")
document.write(document.forms.length + " forms.")
</script>

</body>
</html>
TIY
ĵбĿ
ʼеĿ346ضĵ Image ãۼϣ ͼ񼯡ͼ񼯡ضĵ Image á



÷
images Ͽɷضĵ Image á
﷨
document.images[]
ʾע
עͣΪ 0  DOM ݣüϲ <object> Ƕͼ
ʵ
<html>

<body>
<img border="0" src="hackanm.gif" width="48" height="48">
<br />
<img border="0" src="compman.gif" width="107" height="98">
<br /><br />

<script type="text/javascript">
document.write("This document contains: ")
document.write(document.images.length + " images.")
</script>
</body>

</html>
TIY
ĵеͼĿ346ضĵAreaLinkãۼϣݼԴԴضĵArea Link á



÷
links Ͽɷضĵ Area  Link á
﷨
document.links[]
ʵ
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>
<br />

Number of links in this document:
<script type="text/javascript">
document.write(document.links.length)
</script>

</body>
</html>
TIY
ĵӵĿ
ĵеһӵ id346ṩbodyԪصֱӷ                ṩ <body> Ԫصֱӷʡ
ڶ˿ܼĵ <frameset>346û򷵻뵱ǰĵйصcookie    ʶʶû򷵻뵱ǰĵйص cookie



÷
cookie Կûѯ뵱ǰĵص cookie
﷨
document.cookie
˵
һɶдַʹøԶԵǰĵ cookie жȡ޸ĺɾ
ʾע
ʾԵΪͨĶ/дǲͬġ
ʵ
<html>
<body>

The cookies associated with this document is: 
<script type="text/javascript">
document.write(document.cookie)
</script>

</body>
</html>
TIY
뵱ǰĵص cookie346صǰĵ                      صǰĵ



÷
domain Կɷصǰĵķ
﷨
document.domain
˵
һַֻ뵱ǰĵ web 
ʾע
ʾdomain ԿԽͬԴȫԴĲͬĵԹ⡣
˽ͬԴȫԵϸϢ
ʵ
<html>
<body>

The domain name for this document is: 
<script type="text/javascript">
document.write(document.domain)
</script>

</body>
</html>
һ
TIY
صǰĵķ346ĵ޸ĵںʱ          ޸ʱ޸ʱĵ޸ĵںʱ䡣



÷
lastModified Կɷĵ޸ĵںʱ䡣
﷨
document.lastModified
˵
ֵ Last-Modified HTTP ͷ Web ͵Ŀѡ
ʵ
<html>
<body>

This document was last modified on:
<script type="text/javascript">
document.write(document.lastModified)
</script>

</body>
</html>
TIY
ĵ޸ĵںʱ346뵱ǰĵĵ URL            URLURL뵱ǰĵĵ URL



÷
referrer Կɷ뵱ǰĵĵ URL
﷨
document.referrer
˵
ǰĵͨӷʵģΪ nullͻ JavaScript  HTTP ͷ
ʵ
<html>
<body>

The referrer of this document is:
<script type="text/javascript">
document.write(document.referrer)
</script>

</body>
</html>
TIY
صǰĵ referrer346صǰĵı                      صǰĵı⡣



÷
title Կɷصǰĵı⣨ HTML title Ԫеı
﷨
document.title
ʵ
<html>
<head>
<title>My title</title>
</head>

<body>
The title of the document is: 
<script type="text/javascript">
document.write(document.title)
</script>
</body>

</html>
TIY
صǰĵı346صǰĵ URL                      ĵURLĵURLصǰĵ URL


÷
URL Կɷصǰĵ URL
﷨
document.URL
˵
һ£Եֵĵ Window  location.href ͬ URL ضʱ URL Աĵʵ URL location.href  URL
ʵ
<html>

<body>
The URL of this document is: 
<script type="text/javascript">
document.write(document.URL)
</script>
</body>

</html>
TIY
صǰĵ URL346رĵ()ʾѡ()رաرաر  document.open() 򿪵ʾѡݡ



÷
close() ɹرһ document.open 򿪵ʾѡݡ
﷨
document.close()
˵
÷ر open() 򿪵ĵǿƵʾлݡʹ write() ̬һĵסôʱҪ close() ȷĵݶʾ
һ close()ͲӦٴε write()Ϊʽص open() ǰĵʼһµĵ
ʵ
<html>
<head>
<script type="text/javascript">
function createNewDoc()
  {
  var newDoc=document.open("text/html","replace");
  var txt="<html><body>Learning about the DOM is FUN!</body></html>";
  newDoc.write(txt);
  newDoc.close();
  }
</script>
</head>
<body>

<input type="button" value="Write to a new document"
onclick="createNewDoc()">

</body>
</html>
TIY
һµĵһЩıȻر
´ڴµĵһЩı


346ضӵָidĵһ()    ȡȡضӵָ id ĵһá



÷
getElementById() ɷضӵָ ID ĵһá
﷨
document.getElementById(id)
˵
HTML DOM ˶ֲԪصķ getElementById() ֮⣬ getElementsByName()  getElementsByTagName()
ҪĵеһضԪأЧķ getElementById()
ڲĵһضԪʱøԪһ id ԣΪָһĵУΨһƣȻͿø ID ҪԪء
ʵ
 1
<html>
<head>
<script type="text/javascript">
function getValue()
  {
  var x=document.getElementById("myHeader")
  alert(x.innerHTML)
  }
</script>
</head>
<body>

<h1 id="myHeader" onclick="getValue()">This is a header</h1>
<p>Click on the header to alert its value</p>

</body>
</html>
 2
getElementById() һҪķ DOM Уʹ÷ǳΪһߺͿͨһ϶̵ʹ getElementById() ˣ
function id(x) {
  if (typeof x == "string") return document.getElementById(x);
  return x;
  }
Ԫ ID ΪǵĲÿĲֻҪʹǰд x = id(x) Ϳˡ
TIY
ʹ getElementById()346شָƵĶ󼯺()            ȡȡشָƵĶ󼯺ϡ



÷
getElementsByName() ɷشָƵĶļϡ
﷨
document.getElementsByName(name)
÷ getElementById() ƣѯԪص name ԣ id ԡ
⣬Ϊһĵе name ԿܲΨһ HTML еĵѡťͨͬ name ԣ getElementsByName() صԪص飬һԪء
ʵ
<html>
<head>
<script type="text/javascript">
function getElements()
  {
  var x=document.getElementsByName("myInput");
  alert(x.length);
  }
</script>
</head>
<body>

<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<br />
<input type="button" onclick="getElements()"
value="How many elements named 'myInput'?" />

</body>
</html>
TIY
ʹ getElementsByName()346شָǩĶ󼯺()          ȡȡشָǩĶ󼯺ϡ



÷
getElementsByTagName() ɷشָǩĶļϡ
﷨
document.getElementsByTagName(tagname)
˵
getElementsByTagName() Ԫص˳ĵе˳
ַ "*" ݸ getElementsByTagName() ĵԪصбԪе˳ĵе˳
ʾע
עͣݸ getElementsByTagName() ַԲִСд
ʵ
 1
<html>
<head>
<script type="text/javascript">
function getElements()
  {
  var x=document.getElementsByTagName("input");
  alert(x.length);
  }
</script>
</head>
<body>

<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<input name="myInput" type="text" size="20" /><br />
<br />
<input type="button" onclick="getElements()"
value="How many input elements?" />

</body>
</html>
 2
 getElementsByTagName() ȡκ͵ HTML Ԫصб磬Ĵɻȡĵеı
var tables = document.getElementsByTagName("table");
alert ("This document contains " + tables.length + " tables");
 3
ǳ˽ĵĽṹҲʹ getElementsByTagName() ȡĵеһضԪء磬ĴԻĵеĵĸ䣺
var myParagragh = document.getElementsByTagName("p")[3];
ǻΪҪĳضԪأʹ getElementById() ΪЧ
TIY
ʹ getElementsByTagName()346ռ.().writeln()()     򿪡򿪡һռκ document.write()  document.writeln() 



÷
open() ɴһĵǰĵݡ
﷨
document.open(mimetype,replace)
	
mimetype	ѡ涨дĵ͡Ĭֵ "text/html"
replace	ѡ˲ú󣬿ĵӸĵ̳ʷĿ
˵
÷ǰ HTML ĵݣʼһµĵĵ write()  writeln() д
ʾע
Ҫ open() һĵ write() ĵݺ󣬱ס close رĵʹʾ
עͣڱǵĵһֵĽű¼ܵø÷Ϊű¼Ҳᱻǡ
ʵ
<html>
<head>
<script type="text/javascript">
function createNewDoc()
  {
  var newDoc=document.open("text/html","replace");
  var txt="<html><body>Learning about the DOM is FUN!</body></html>";
  newDoc.write(txt);
  newDoc.close();
  }
</script>
</head>
<body>

<input type="button" value="Write to a new document"
onclick="createNewDoc()">

</body>
</html>
TIY
һµĵһЩıȻر
´ڴµĵһЩı346ĵдHTMLʽJavaScript()    ĵд HTML ʽ  JavaScript 롣



÷
write() ĵд HTML ʽ JavaScript 롣
г(exp1,exp2,exp3,...) ǽ˳׷ӵĵС
﷨
document.write(exp1,exp2,exp3,....)
˵
Ȼ DOM ׼÷ַֻܵΪݾ飬write() ɽκζ
ֵͨķʽʹ write() һʹø÷ĵ HTMLһڵø÷ĵĴ֮ĴڡвĵڵڶУʹ close() رĵ
ʵ
<html>
<body>

<script type="text/javascript">
document.write("Hello World!");
</script>

</body>
</html>
TIY
ʹ document.write() дı
ʹ document.write() д HTML
ʹö document.write()346ͬ()ÿʽдз()  ͬ write() ͬÿʽ֮дһз



÷
writeln()  write() ͬӿÿʽдһз
﷨
document.writeln(exp1,exp2,exp3,....)
ʾע
ʾڱд <pre> ǵʱ÷á
ʵ
<html>
<body>

<script type="text/javascript">
document.writeln("Hello World!");
</script>

</body>
</html>
TIY
ʹ document.write() дı
ʹ document.write() д HTML
ʹö document.write()346ذָԪصĽڵб()  ȡȡذָԪصĽڵб



ΪIE֧getElementsByClassNameҪԼдһõclass

ǻ֪getElementsByClassNameֱӵ

 

<html>
<head>
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            var tagName = getClass("div", "a1");

           //ΪصǰԪص飬Ҫһ
            for (var i = 0; i < tagName.length; i++) { 

                tagName[i].innerHTML = "";
            }
           
            var tagName = getClass("div", "a2");
            for (var i = 0; i < tagName.length; i++) {
                tagName[i].innerHTML = "ALL";
            }
        }

        function getClass(tagname, className) { //tagnameָԪأclassNameָclassֵ

         //жǷ֧getElementsByClassName֧־ֱӵ
            if (document.getElementsByClassName) {   

                return getElementsByClassName(className);
            }
            else {    //֧getElementsByClassNameʱķ
                var tagname = document.getElementsByTagName_r(tagname);  //ȡָԪ
                var tagnameAll = [];     //ڴ洢зԪ
                for (var i = 0; i < tagname.length; i++) {     //õԪ
                    if (tagname[i].className == className) {     //õԪеclassֵָ͸ֵtagnameAll
                        tagnameAll[tagnameAll.length] = tagname[i];
                    }
                }
                return tagnameAll;
            }
        }
    </script>
</head>
<body>
<div class="a1"></div>
<div class="a1"></div>
<div class="a1"></div>
<div class="a1"></div>
<div class="a2"></div>
<div class="a2"></div>
<div class="a2"></div>
<div class="a2"></div>
</body>
</html>

ҽ鲻ҪķJQueryʡȥܶĴ
346µӽڵӵָڵ()            ӽڵӽڵµӽڵӵָڵ㡣



appendChild() ָԪؽڵһӽڵ֮ӽڵ㡣

÷µӽڵ㡣

ע: 

appendChild()ͨdocument.createElement("div")document.getElementById("id")ͬãʾȴȻӡ

appendChild()Ĳַһ

 nDiv = document.createElement("div");document.body.appendChild(nDiv);nDivûŵģǸdiv 

html

[html] view plaincopyprint?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<title>appendChild</title>  
<style>   
div{ background:#0000FF;width:100px;height:100px;}    
span{ background:#00FF00;width:100px;height:100px;}    
p{ background:#FF0000;width:100px;height:100px;}    
</style>   
</head>   
<body>   
<div id="a"><span>SPAN</span>DIV</div>   
<span>SPAN</span>  
<p>P</p>   
<button type="button" onclick=cloneX()>½ڵ</button>  
</body>  
</html>  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>appendChild</title>
<style> 
div{ background:#0000FF;width:100px;height:100px;}  
span{ background:#00FF00;width:100px;height:100px;}  
p{ background:#FF0000;width:100px;height:100px;}  
</style> 
</head> 
<body> 
<div id="a"><span>SPAN</span>DIV</div> 
<span>SPAN</span>
<p>P</p> 
<button type="button" onclick=cloneX()>½ڵ</button>
</body>
</html>
js

[javascript] view plaincopyprint?function cloneX(){  
    var nDiv = document.createElement("div");  //֮ͨappendChild()֮ĺҳʾ   
    document.body.appendChild(nDiv); //document.appendChild,document.body.appendChild();   
    //var txt = document.createElement("input");   
    try{  
        var txt = document.createElement("<input name='bobo' />")   
        //ֻIEԿ,FFcatch(e).дIEFFĲԺãnameԣFFдIEϣIEҪдͨԿд   
    }  
    catch(e){  
        var txt = document.createElement("input") //FFַͨʽIEһIEҲֱַʽ   
        txt.name = 'bobo';  
    }  
    txt.style.margin = 10+'px';  
    txt.value = "bobowa";  
    nDiv.appendChild(txt);  
    b = document.getElementsByName("bobo")[0];  
    alert(b.value)  
}  

	function cloneX(){
		var nDiv = document.createElement("div");  //֮ͨappendChild()֮ĺҳʾ
		document.body.appendChild(nDiv); //document.appendChild,document.body.appendChild();
		//var txt = document.createElement("input");
		try{
			var txt = document.createElement("<input name='bobo' />") 
			//ֻIEԿ,FFcatch(e).дIEFFĲԺãnameԣFFдIEϣIEҪдͨԿд
		}
		catch(e){
			var txt = document.createElement("input") //FFַͨʽIEһIEҲֱַʽ
			txt.name = 'bobo';
		}
		txt.style.margin = 10+'px';
		txt.value = "bobowa";
		nDiv.appendChild(txt);
		b = document.getElementsByName("bobo")[0];
		alert(b.value)
	}
FFôIE,outHTML

html

[html] view plaincopyprint? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">   
<html xmlns="http://www.w3.org/1999/xhtml">   
<head>   
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />   
<title>ȡouterHMTL</title>   
<style>   
div{ background:#0000FF;width:100px;height:100px;}    
span{ background:#00FF00;width:100px;height:100px;}    
p{ background:#FF0000;width:100px;height:100px;}    
</style>   
</head>   
<body>   
<div id="a"><span>SPAN</span>DIV</div>   
<span>SPAN</span>  
<p>P</p>   
</body>  
</html>  

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>ȡouterHMTL</title> 
<style> 
div{ background:#0000FF;width:100px;height:100px;}  
span{ background:#00FF00;width:100px;height:100px;}  
p{ background:#FF0000;width:100px;height:100px;}  
</style> 
</head> 
<body> 
<div id="a"><span>SPAN</span>DIV</div> 
<span>SPAN</span>
<p>P</p> 
</body>
</html>
js

[javascript] view plaincopyprint?function getOuterHTML(id){  
 var el = document.getElementById(id);  
 var newNode = document.createElement("div");  
 //document.appendChild(newNode);   
 document.body.appendChild(newNode);  
 var clone = el.cloneNode(true);  
 newNode.appendChild(clone);  
 alert(newNode.innerHTML);  
 document.body.removeChild(newNode);  
}  
getOuterHTML("a");  
346ɾӽڵ()                            ɾڵɾڵɾӽڵ㡣



ɾе HTML Ԫ
ɾ HTML ԪأԪصĸԪأ
ʵ
<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>
<script>
var parent=document.getElementById("div1");
var child=document.getElementById("p1");
parent.removeChild(child);
</script>
һ
ӽ
 HTML ĵһӽڵ㣨 <p> Ԫأ <div> Ԫأ
<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>
 id="div1" Ԫأ
var parent=document.getElementById("div1");
 id="p1"  <p> Ԫأ
var child=document.getElementById("p1");
ӸԪɾԪأ
parent.removeChild(child);
ʾܷڲøԪصɾĳԪأ
ܱǸDOM Ҫ˽ҪɾԪأԼĸԪء
ṩһõĽҵҪɾԪأȻʹ parentNode 丸Ԫأ
var child=document.getElementById("p1");
child.parentNode.removeChild(child);346滻ӽڵ()                            ڵڵ滻ӽڵ㡣



滻 HTML Ԫ
滻 HTML DOM еԪأʹ replaceChild() 
ʵ
<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>

<script>
var para=document.createElement("p");
var node=document.createTextNode("This is new.");
para.appendChild(node);

var parent=document.getElementById("div1");
var child=document.getElementById("p1");
parent.replaceChild(para,child);
</script>
һԡ346ָӽڵǰµӽڵ()      ڵڵָӽڵǰµӽڵ㡣



һе appendChild() ԪΪԪصһԪؽӡ
ϣˣʹ insertBefore() 
ʵ
<div id="div1">
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>

<script>
var para=document.createElement("p");
var node=document.createTextNode("This is new.");
para.appendChild(node);

var element=document.getElementById("div1");
var child=document.getElementById("p1");
element.insertBefore(para,child);
</script>
һԡ346Խڵ()                          ڡڡԽڵ㡣346Ԫؽڵ()                          ԪڡԪڡԪؽڵ㡣346ıڵ()                          ĽڡĽڡıڵ㡣346ֵָ()                      ȡԡȡԡֵָ346ָû޸Ϊֵָ()        ԡԡָû޸Ϊֵָ345ӡӡAnchor 
Anchor ʾ HTML ӡ
 HTML ĵ <a> ǩÿһΣͻᴴ Anchor 
êڴָһĵӣͨ href ԣߴĵڵǩͨ name ԣ
ͨ Document е anchors[] êʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.377û򷵻طһӵĿݼ          ݼݼû򷵻طһӵĿݼ



÷
accessKey Կû򷵻طһӵļ̰
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
anchorObject.accessKey=accessKey
ʵ
ӽΪÿݼ
<html>
<head>
<script type="text/javascript">
function accesskey()
  {
  document.getElementById('w3').accessKey="w"
  }
</script>
</head>

<body onload="accesskey()">

<a id="w3" href="http://www.w3school.com.cn/">W3School.com.cn</a>

</body>
</html>
TIY
ӿݼ377û򷵻رԴַ            ַַû򷵻رԴַ


÷
charset Կû򷵻رԴַ
﷨
anchorObject.charset=charset
ʵ
ӿñԴַ
<html>
<body>

<p>
<a id="myAnchor" 
href="http://www.w3school.com.cn">W3School.com.cn</a>
</p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
x.charset="ISO-8859-1";
</script>

</body>
</html>
TIY
ñԴַ377ȡбͼӳӵ      û򷵻ضŷָбͼӳӵꡣ



÷
coords û򷵻һŷָбаͼӳһӵꡣ
﷨
anchorObject.coords=coordinates
ʵ
ӿɷͼӳһӵ꣺
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Venus coordinates:
<script type="text/javascript">
x=document.getElementById("venus");
document.write(x.coords);
</script>
</p>

</body>
</html>377û򷵻رԴURL               URLURLû򷵻رԴ URL




÷
href Կû򷵻رԴ URL
﷨
anchorObject.href=URL
ʵ
ӽһӵıURL Լ target
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="W3School";
document.getElementById('myAnchor').href="http://www.w3school.com.cn";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>

<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>

</html>
TIY
һӵıURL Լ target377û򷵻رԴԴ          û򷵻رԴԴ롣



÷
hreflang Կû򷵻رԴԴ롣
﷨
anchorObject.hreflang=languagecode
ʵ
ӽرԴԴ룺
<html>
<body>

<p><a id="myAnchor" hreflang="zh-cn" 
href="http://www.w3school.com.cn">W3School.com.cn</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.hreflang);
</script>

</body>
</html>
TIY
ȡñԴԴ377û򷵻һӵ id                 ididû򷵻һӵ id



÷
id Կɷһӵ id
﷨
anchorObject.id=ide
ʵ
ӿһӵ id
<html>
<body>

<p><a id="myAnchor"
href="http://www.w3school.com.cn">Visit W3School.com.cn</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.id);
</script>

</body>
</html>
TIY
ȡӵ id377û򷵻һӵ                ݡݡû򷵻һӵݡ


÷
innerHTML û򷵻һӵݡ
﷨
anchorObject.innerHTML=text
ʵ
ӽһӵıURL Լ target
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="W3School";
document.getElementById('myAnchor').href="http://www.w3school.com.cn";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>

<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>

</html>
TIY
һӵıURL Լ target377û򷵻һӵ                ơơû򷵻һӵơ



÷
name Կû򷵻ӵơ
﷨
anchorObject.name=name
ʵ
ӿɷӵƣ
<html>
<body>

<p><a id="myAnchor" name="myAnchor"
href="http://www.w3school.com.cn">Visit W3School.com.cn</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.name);
</script>

</body>
</html>
TIY
ȡӵơ377û򷵻صǰĵĿ URL֮ϵ    ϵϵû򷵻صǰĵĿ URL ֮Ĺϵ



÷
rel Կû򷵻صĿĵĹϵ
rel  rev Կͬʱ <a> ǩʹá
rel (relationship) Թ涨˴ԴĵĿĵĹϵrev (reverse) Թ涨˴Ŀĵǰĵķϵ
ʹǸıêݵۣԶĵ˵ҲʹЩԹӼϡĿ¼ȡ
﷨
anchorObject.rel=relationship
Ծɲֵ
ֵ	
appendix	ӵĵĸ¼ҳ
alternate	ӵһѡԴ
bookmark	ӵһǩ web blogs г "permalink"
chapter	ӵǰĵӵһ½ڡ
contents	ӵǰĵĿ¼
copyright	ӵǰĵİȨ˽ҳ档
glossary	ӵǰĵ
index	ӵǰĵ
next	ӵеһĵ
prev	ӵеǰһĵ
section	ӵĵбеһСڡ
start	ӵǰĵĵһҳ
subsection	ӵǰĵбеСڡһСڿӵжСڡ
head	ӵеĶĵ
toc	ӵϵĿ¼
parent	ӵԴĵ
child	ӵԴĵ
ʵ
ӿɷӵĹϵ
<html>
<body>

<p><a id="myAnchor" rel="index"
href="http://www.w3school.com.cn">Visit W3School.com.cn</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.rel);
</script>

</body>
</html>
TIY
ȡӵĹϵ377revԹ涨Ŀĵǰĵϵ ϵϵû򷵻Ŀ URL ֮䵱ǰĵĹϵ



÷
rev Կû򷵻һӵķϵ
rel  rev Կͬʱ <a> ǩʹá
rel (relationship) Թ涨˴ԴĵĿĵĹϵrev (reverse) Թ涨˴Ŀĵǰĵķϵ
ʹǸıêݵۣԶĵ˵ҲʹЩԹӼϡĿ¼ȡ
﷨
anchorObject.rev=relationship
Ծɲֵ
ֵ	
appendix	ӵĵĸ¼ҳ
alternate	ӵһѡԴ
bookmark	ӵһǩ web blogs г "permalink"
chapter	ӵǰĵӵһ½ڡ
contents	ӵǰĵĿ¼
copyright	ӵǰĵİȨ˽ҳ档
glossary	ӵǰĵ
index	ӵǰĵ
next	ӵеһĵ
prev	ӵеǰһĵ
section	ӵĵбеһСڡ
start	ӵǰĵĵһҳ
subsection	ӵǰĵбеСڡһСڿӵжСڡ
head	ӵеĶĵ
toc	ӵϵĿ¼
parent	ӵԴĵ
child	ӵԴĵ
ʵ
ӿɷӵķϵ
<html>
<body>

<p><a id="myAnchor" rev="subsection"
href="/htmldom/prop_anchor_rev.asp">
HTML DOM rev Property</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.rev);
</script>

</body>
</html>
TIY
ȡӵķϵ377û򷵻ͼӳĳӵ״      ״״û򷵻ͼӳĳӵ״



÷
shape Կû򷵻ͼӳӵ״
﷨
anchorObject.shape=RECT|CIRCLE|POLY|DEFAULT
ʵ
ӿɷͼӳӵ״
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Shape of Venus-link:
<script type="text/javascript">
x=document.getElementById("venus");
document.write(x.shape);
</script>
</p>

</body>
</html>
TIY
ȡͼӳӵ״377û򷵻ĳӵTabƴ       tabtabû򷵻ĳӵ Tab ƴ



÷
tabIndex ԿΪû򷵻 tab ƴ
﷨
anchorObject.tabIndex=tabIndex
ʵ
ӿɸӵ tab ƴ
<html>
<head>
<script type="text/javascript">
function changeTabIndex()
  {
  document.getElementById('1').tabIndex="3"
  document.getElementById('2').tabIndex="2"
  document.getElementById('3').tabIndex="1"
  }
</script>
</head>

<body>
<p><a id="1" href="http://www.w3school.com.cn">1</a></p>
<p><a id="2" href="http://www.w3school.com.cn">2</a></p>
<p><a id="3" href="http://www.w3school.com.cn">3</a></p>

<input type="button" onclick="changeTabIndex()"
value="Change TabIndex" />

</body>
</html>
TIY
Ϊ tab ƴ377û򷵻ںδ                δδû򷵻ںδӡ


÷
target Կû򷵻ںδӡ
﷨
anchorObject.target=_blank|_parent|_self|_top 
ĸĿƣ
_blank - һµδĴĵ
_self - ͬĿܻ򴰿Ŀĵ
_parent - ĵ븸ڻ˳õĿܵĿܼ
_top - ĵóӵĴ,ȡκεǰڴʾĿ
ʵ
ӽһӵıURL Լ target
<html>
<head>
<script type="text/javascript">
function changeLink()
{
document.getElementById('myAnchor').innerHTML="W3School";
document.getElementById('myAnchor').href="http://www.w3school.com.cn";
document.getElementById('myAnchor').target="_blank";
}
</script>
</head>

<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>

</html>
TIY
һӵıURL Լ target377û򷵻رԴ MIME         ͡͡û򷵻رԴ MIME ͡



÷
type Կû򷵻رԴ MIME ͡
﷨
anchorObject.type=type
ʵ
ӿɷرԴ MIME ͣ
<html>
<body>

<p><a id="myAnchor" type="text/html" 
href="http://www.w3school.com.cn">W3School.com.cn</a></p>

<script type="text/javascript">
x=document.getElementById("myAnchor");
document.write(x.type);
</script>

</body>
</html>
TIY
ȡӵ MIME ͡377û򷵻Ԫصclass Ϊԣû򷵻Ԫص class ԡ



÷
className û򷵻Ԫص class ԡ
﷨
object.className=classname
ʵ
չʾֻ <body> Ԫص class Եķ
<html>
<body id="myid" class="mystyle">

<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body CSS class: " + x.className);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').className);
</script>

</body>
</html>

Body CSS class: mystyle
An alternate way: mystyle
TIY
 <body> Ԫص class ԡ377û򷵻ıķ      Ϊԣııû򷵻ıķ


÷
dir û򷵻Ԫصַ
﷨
object.dir=text-direction
ʵ
չʾֻȡ <body> Ԫصıķ
<html>
<body id="myid" dir="rtl">

<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Text direction: " + x.dir);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').dir);
</script>

</body>
</html>
TIY
<body> Ԫصı377û򷵻ԪصԴ  ΪԣԴԴû򷵻ԪصԴ롣




÷
lang û򷵻Ԫصԡ
﷨
object.lang=language-code
ʵ
չʾֻȡ <body> ԪصԵķ
<html>
<body id="myid" lang="en-us">

<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body language: " + x.lang);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').lang);
</script>

</body>
</html>
TIY
<body> ԪصԴ377û򷵻Ԫصtitle Ϊԣû򷵻Ԫص title ԡ



÷
title û򷵻Ԫصģѯʵģ⡣
﷨
object.title=title
ʵ 1
չʾֻȡ <body> Ԫص title Եķ
<html>
<body id="myid" title="mytitle">

<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body title: " + x.title);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').title);
</script>

</body>
</html>
ʵ 2
ͼӳĳ title
<html>
<body>

<img src ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap" />

<map name ="planetmap">
<area id="venus" shape="circle"
coords ="124,58,8"
title="Venus"
href ="venus.htm"  />
</map>

<p>Venus' advisory title (mouse over the Venus planet): 
<script type="text/javascript">
x=document.getElementById('venus')
document.write(x.title)
</script>
</p>

</body>
</html>
TIY
 <body> Ԫص title 
ͼӳĳ title377ѽƿ()                    ƽƽѽƿ



÷
blur() ڴƿ㡣
﷨
anchorObject.blur()
ʵ
<html>
<head>
<style type="text/css">
a:active {color:green}
</style>

<script type="text/javascript">
function getfocus()
{document.getElementById('myAnchor').focus()}

function losefocus()
{document.getElementById('myAnchor').blur()}
</script>
</head>

<body>
<a id="myAnchor"
href="http://www.w3school.com.cn">Visit W3School.com.cn</a>
<br /><br/>
<input type="button" onclick="getfocus()" value="Get focus">
<input type="button" onclick="losefocus()" value="Lose focus">
</body>

</html>
TIY
ʹ focus()  blur()377Ӧý()                        Ӧý㡣



÷
focus() ڸӽ㡣
﷨
anchorObject.focus()
˵
÷ɹĵʹ Anchor λñΪɼ
ʵ
<html>
<head>
<style type="text/css">
a:active {color:green}
</style>

<script type="text/javascript">
function getfocus()
{document.getElementById('myAnchor').focus()}

function losefocus()
{document.getElementById('myAnchor').blur()}
</script>
</head>

<body>
<a id="myAnchor"
href="http://www.w3school.com.cn">Visit W3School.com.cn</a>
<br /><br/>
<input type="button" onclick="getfocus()" value="Get focus">
<input type="button" onclick="losefocus()" value="Lose focus">
</body>

</html>
TIY
ʹ focus()  blur()345ͼͼArea 
Area ͼӳһͼӳָǴпɵͼ
 HTML ĵ <area> ǩÿһΣͻᴴһ Area 
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.398û򷵻طĳĿݼ          ݼݼû򷵻طĳĿݼ



÷
accessKey Կû򷵻طĳĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
areaObject.accessKey=accessKey
ʵ
ӿɷͼӳ "Venus" Ŀݼ
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" accessKey="v" />
</map>

<p>Access key for "Venus" is:
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.accessKey);
</script>
</p>

</body>
</html>
TIY
ͼӳĳĿݼ398û򷵻ص޷ʾ滻          ġġû򷵻ص޷ʾĳʱ滻֡



÷
alt Կû򷵻ص޷ʾĳʱʾ滻ı
﷨
areaObject.alt=alternate_text
ʵ
ӿɷͼӳ "Venus" 滻ı
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="The planet Venus"
href="venus.htm" />
</map>

<p>Alternate text for "Venus" is:
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.alt);
</script>
</p>

</body>
</html>
TIY
ͼӳĳ滻ı398û򷵻ͼӳпɵ    û򷵻ͼӳпɵꡣ



÷
coords Կû򷵻ͼӳĳɵꡣ
﷨
areaObject.coords=coordinates
ʵ
ӿɷͼӳĳɵ꣺
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Venus coordinates:
<script type="text/javascript">
x=document.getElementById("venus");
document.write(x.coords);
</script>
</p>

</body>
</html>
TIY
ͼӳĳɵ398û򷵻ĳ URL ê       êêû򷵻ĳ URL ê֡



÷
hash Կû򷵻һ URL ê֡
﷨
areaObject.hash=anchorname
ʵ
ӿɰ URL ê #top Ϊ #bottom
<html>
<head>
<script type="text/javascript">
function changeLink()
  {
  document.getElementById('venus').hash="bottom"
  }
</script>
</head>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus2.htm#top" />
</map>

<input type="button" onclick="changeLink()" value="Change link" />

</body>
</html>
TIY
һ URL ê֡398û򷵻ĳURLͶ˿   ˿ڡ˿ڡû򷵻ĳ URL Ͷ˿ڡ



÷
host Կû򷵻 URL Ͷ˿ڡ
﷨
areaObject.host=host
ʵ
ӿɷ "Venus" Ͷ˿ڣ
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>The hostname and port for the "Venus" area are:
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.host);
</script>
</p>

</body>
</html>
TIY
ͼӳĳӵͶ˿ڡ398û򷵻ͼӳӵURL           URLURLû򷵻ͼӳӵ URL


÷
href Կû򷵻ͼӳӵ URL
﷨
areaObject.href=URL
ʵ
ӽͼӳĳӣ
<html>
<head>
<script type="text/javascript">
function changeLink()
  {
  document.getElementById('venus').href="http://www.w3school.com.cn"
  }
</script>
</head>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<input type="button" onclick="changeLink()" value="Change link" />

</body>
</html>
TIY
ͼӳĳӵ URL398û򷵻ĳid                  ididû򷵻ĳ id



÷
id Կû򷵻ͼӳĳ id
﷨
areaObject.id=id
ʵ
ӿɷͼӳ "Venus"  id
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>"Venus" area id = 
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.id);
</script>
</p>

</body>
</html>
TIY
ͼӳĳ id398û򷵻ĳǷ              ǻǻû򷵻ĳǷӦǻĻǷǻġ



÷
noHref Կû򷵻ĳǻĻǷǻġ
﷨
areaObject.noHref=true|false
˵
<area> ǩ nohref ڿͻͼӳжһе򣬶򲻻ûѡȡʱȡκβΪÿ <area> ǩһ href  nohref ԡ
ʵ
ӿɷͼӳ "Venus"  "noHref" ״̬
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>noHref status:
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.noHref);
</script>
</p>

</script>
</body>
</html>
TIY
ͼӳĳ noHref ״̬398û򷵻ĳURL·           URL·URL·û򷵻ĳе URL ·



÷
pathname Կû򷵻ĳ link-URL ·
﷨
areaObject.pathname=pathnamee
ʵ
ӿɷ "Venus"  link-URL ·
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Venus' pathname: 
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.pathname);
</script>
</p>

</body>
</html>
TIY
ȡͼӳĳ link-URL ·398û򷵻ĳе URL Э       ЭЭû򷵻ĳе URL Э顣




÷
protocol Կû򷵻ĳ link-URL Э顣
﷨
areaObject.protocol=protocol
ʵ
ӿɷ "Venus"  link-URL Э飺
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Venus' protocol:
<script type="text/javascript">
x=document.getElementById('venus');
document.write(x.protocol);
</script>
</p>

</body>
</html>
TIY
ȡͼͼĳ link-URL õЭ398û򷵻ĳURLѯַ     ѯѯû򷵻ĳ URL Ĳѯַ֡



÷
search Կû򷵻ĳ link-URL Ĳѯַ֡
﷨
areaObject.search=querystring
ʵ
ӿɷ "Venus" е link-URL Ĳѯַ֣
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm?id=venus" />
</map>

<p>Query string part of Venus' link-URL: 
<script type="text/javascript">
x=document.getElementById('venus')
document.write(x.search)
</script>
</p>

</body>
</html>
TIY
ͼӳĳӵĲѯַ֡398û򷵻ͼӳĳ״      ״״û򷵻ͼӳĳ״



÷
shape Կû򷵻ͼӳĳ״
﷨
areaObject.shape=RECT|CIRCLE|POLY|DEFAULT
ʵ
ӿɷͼӳ "Venus" ״
<html>
<body>

<img src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="Venus"
href="venus.htm" />
</map>

<p>Venus shape:
<script type="text/javascript">
x=document.getElementById("venus");
document.write(x.shape);
</script>
</p>

</body>
</html>
TIY
ͼӳĳ״398û򷵻ĳtabƴ       tabtabû򷵻ĳ tab ƴ




÷
tabIndex Կû򷵻ĳ tab ƴ
﷨
areaObject.tabIndex=tabIndex
ʵ
ӿչʾͼӳ tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
{
var sun=document.getElementById('sun').tabIndex;
var mercury=document.getElementById('mercury').tabIndex;
var venus=document.getElementById('venus').tabIndex;

document.write("Tab index of Sun: " + sun);
document.write("<br />");
document.write("Tab index of Mercury: " + mercury);
document.write("<br />");
document.write("Tab index of Venus: " + venus);
}
</script>
</head>
<body>

<img src ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap" />

<map name="planetmap">
<area shape ="rect" coords ="0,0,82,126"
href ="sun.htm" id="sun" tabIndex="1" />
<area shape ="circle" coords ="90,58,3"
href ="mercur.htm" id="mercury" tabIndex="2" />
<area shape ="circle" coords ="124,58,8"
href ="venus.htm" id="venus" tabIndex="3" />
</map>

<input type="button" onclick="showTabIndex()"
value="Show tabIndex" />

</body>
</html>
TIY
ͼӳ tab ƴ398û򷵻ںδеlink-URL    δδû򷵻ںδе link-URL



÷
target Կû򷵻ںδе link-URL
﷨
areaObject.target=_blank|_parent|_self|_top
ĸĿƣ
_blank - һµδĴĵ
_self - ͬĿܻ򴰿Ŀĵ
_parent - ĵ븸ڻ˳õĿܵĿܼ
_top - ĵóӵĴ,ȡκεǰڴʾĿ
ʵ
The following example changes the target of the link in the image-map:
<html>
<head>
<script type="text/javascript">
function changeTarget()
  {
  document.getElementById('venus').target="_blank"
  }
</script>
</head>
<body>

<img src ="planets.gif"
width="145" height="126"
alt="Planets"
usemap ="#planetmap" />

<map name ="planetmap">
<area shape ="circle" coords ="124,58,8"
href ="venus.htm" id="venus" />
</map>
<br />
<input type="button" onclick="changeTarget()" 
value="Change target" />

</body>
</html>
TIY
ͼӳĳӵ target345ĬϡĬϡBase 
Base  HTML  base Ԫء
 HTML ĵ <base> ÿһΣBase ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.413û򷵻ҳӵĻ׼URL   URLURLû򷵻ҳӵĻ׼ URL


÷
href Կû򷵻ҳӵĻ׼ URL
﷨
baseObject.href=URL
ʵ
ӿɷػ׼ URL
<html>
<head>
<base id="myBaseId" href="http://www.w3school.com.cn/htmldom/" />
</head>

<body>
<p>Base URL:
<script type="text/javascript">
x=document.getElementById('myBaseId');
document.write(x.href);
</script>
</p>

</body>
</html>

Base URL: http://www.w3school.com.cn/htmldom/ 
TIY
ȡ HTML ĵĻ׼ URL413û򷵻<base>Ԫصid                ididû򷵻 <base> Ԫص id



÷
id Կû򷵻 <base> Ԫص id
﷨
baseObject.id=id
ʵ
ӿɷ <base> Ԫص id
<html>
<head>
<base id="myBaseId" href="http://www.w3school.com.cn/htmldom/" />
</head>

<body>
<p>Base id: 
<script type="text/javascript">
x=document.getElementsByTagName('base')[0];
document.write(x.id);
</script>
</body>

</html>

Base id: myBaseId
TIY
ȡ HTML ĵ base id413û򷵻ҳӵĬĿ    δδû򷵻ҳӵĬĿܡ



÷
target Կû򷵻ҳӵĬ target
﷨
baseObject.target=target
ʵ
ӿɷĬϵ target
<html>
<head>
<base id="myBaseId" target="_blank"
href="http://www.w3school.com.cn/htmldom/" />
</head>

<body>

<p>Base target: 
<script type="text/javascript">
x=document.getElementById('myBaseId');
document.write(x.target);
</script>

</body>
</html>

Base target: _blank
TIY
ȡ HTML ĵĻ target345Body 
Body ĵ (HTML body) 
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.417û򷵻 body  id                   ididû򷵻 body  id


÷
id û򷵻 body Ԫص id
﷨
bodyObject.id=id
ʵ
ӽչʾ <body> Ԫص id ַ
<html>
<body id="myid">

<script type="text/javascript">
x=document.getElementsByTagName('body')[0];
document.write("Body id: " + x.id);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myid').id);
</script>

</body>
</html>

Body id: myid
An alternate way: myid
TIY
 <body> Ԫص id345ťťButton 
Button һť
 HTML ĵ <button> ǩÿһΣButton ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.419û򷵻طĳťĿݼ          ݼݼû򷵻طĳťĿݼ



÷
accessKey Կû򷵻طһťļ̰
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
buttonObject.accessKey=accessKey
ʵ
ӿɷһťĿݼ
<html>
<body>

<button id="button1" accessKey="a">
Click Me!</button>

<p>AccessKey for button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
һťĿݼ419û򷵻Ƿðť                  ááû򷵻Ƿðť



÷
disabled Կû򷵻Ƿðť
﷨
buttonObject.disabled=true|false
ʵ
ӽðť
<html>
<head>
<script type="text/javascript">
function disableButton()
{
document.getElementById("myButton").disabled=true
}
</script>
</head>

<body>
<form>
<button id="myButton" onClick="disableButton()">
Click Me!</button>
</form>
</body>

</html>
TIY
ʾť id   + ðť419ض԰ťı              ض԰ťıá



÷
form Կɷض԰ðťıá
ðť򷵻һ form δðť򷵻 null
﷨
buttonObject.form
ʵ
ӿɷظðťı id
<html>
<body>

<form id="form1">
<button id="button1">Click me!</button>
</form>

<p>The form containing the button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ذťı id419û򷵻ذťid                      ididû򷵻ذť id



÷
id Կû򷵻ذť id
﷨
buttonObject.id=id
ʵ
ӿðť id
<html>
<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById("myButton").id)
}
</script>
</head>
<body>

<form>
<button id="myButton" onClick="alertId()">
Click me!</button>
</form>

</body>
</html>
TIY
ʾť id   + ðť419û򷵻ذť                    ơơû򷵻ذťơ


÷
name Կû򷵻ذťơ
﷨
buttonObject.name=name
ʵ
ӿɷذťƣ
<html>
<body>

<button id="button1" name="button1">
Click Me!</button>

<p>The name of the button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ȡťơ419û򷵻ذť Tab ƴ         tabtabû򷵻ذť Tab ƴ



÷
tabIndex Կû򷵻ذť tab ƴ
﷨
buttonObject.tabIndex=tabIndex
ʵ
ӿɷذť tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var b1=document.getElementById('b1').tabIndex;
  var b2=document.getElementById('b2').tabIndex;
  var b3=document.getElementById('b3').tabIndex;
  document.write("Tab index of Button 1: " + b1);
  document.write("<br />");
  document.write("Tab index of Button 2: " + b2);
  document.write("<br />");
  document.write("Tab index of Button 3: " + b3);
  }
</script>
</head>
<body>

<button id="b1" tabIndex="1">Button 1</button><br />
<button id="b2" tabIndex="2">Button 2</button><br />
<button id="b3" tabIndex="3">Button 3</button><br />
<br />
<input type="button" onclick="showTabIndex()"
value="Show tabIndex" />

</body>
</html>
TIY
ذť tab ƴ
419ذťı                      ͡͡ذťı͡



÷
type û򷵻ذť͡
ʾʼΪť涨 type ԡIE Ĭ "button"УԼ W3C 淶У "submit"
﷨
buttonObject.type=value
ֵ
ֵ	
submit	button ύť IE ֮Ĭֵ
button	button ǿɵİťIE Ĭֵ
reset	button ðťݣ
֧
֧ type ԡ
ʵ
ذťͣ
<html>
<head>
<script type="text/javascript">
function alertType()
{
alert(document.getElementById("myButton").type)
}
</script>
</head>

<body>
<form>
<button id="myButton" onClick="alertType()"></button>
</form>
</body>

</html>
һԡ419û򷵻ʾڰťϵı            ֵֵû򷵻ʾڰťϵı


÷
value û򷵻ʾڰťϵı
﷨
buttonObject.value=value
ʵ
ӿɷʾڰťϵı
<html>
<body>

<input type="button" id="button1" name="button1" value="Click Me!" />

<p>The text on the button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.value);
</script></p>

</body>
</html>
TIY
ȡťϵı345Canvas 
Canvas ʾһ HTML Ԫ - <canvas>ûԼΪǶһ API ֽ֧űͻ˻ͼ
ֱڸöָȺ͸߶ȣǣܶͨ CanvasRenderingContext2D á ͨ Canvas  getContext() Ұֱַ "2d" ΪΨһĲݸõġ
<canvas>  Safari 1.3 룬˲οҳʱ Firefox 1.5  Opera 9 Ҳõ֧֡ IE У<canvas> Ǽ API ʹλ excanvas.sourceforge.net  ExplorerCanvas ԴĿģ⡣
ʾϣѧϰʹ <canvas> ͼΣԷ Mozilla ṩ Canvas ̳̣ӢģԼӦ  Canvas ̡̳
Canvas 
height 
ĸ߶ȡһͼһԿָΪһֵǴڸ߶ȵİٷֱȡֵıʱڸûѾɵκλͼĬֵ 300
width 
ĿȡһͼһԿָΪһֵǴڿȵİٷֱȡֵıʱڸûѾɵκλͼĬֵ 300345¼¼ʵ
ĸ갴ť
ǣ
İ unicode ǣ
Ļǣ
shift 
ĸԪرˣ
ĸ¼ͷˣ
Event 
Event ¼״̬¼зԪء̰״̬λá갴ť״̬
¼ͨ뺯ʹã¼ǰִУ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.
¼(Event Handlers)
HTML 4.0 ֮һܹʹ HTML ¼еΪ統ûĳ HTML Ԫʱһ JavaScriptһбɽ֮ HTML ǩԶ¼Ϊ429ͼļرж                        ضϡضϡͼļرжϡ


÷
onabort ¼ͼرжʱ
ûͼ֮ǰͼװأ絥 stop ťʱͻøþ
﷨
onabort="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<img>
ָ֧¼ JavaScript 
image
ʵ 1
ڱУͼļرжϣʾһԻ
<img src="image_w3default.gif"
onabort="alert('Error: Loading of the image was aborted')" />
ʵ 2
ڱУͼļжϣǽһ
<html>
<head>
<script type="text/javascript">
function abortImage()
{
alert('Error: Loading of the image was aborted')
}
</script>
</head>

<body>
<img src="image_w3default.gif" onabort="abortImage()" />
</body>

</html>429Ԫʧȥ                            ʧʧԪʧȥ㡣


÷
onblur ¼ڶʧȥʱ
﷨
onblur="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, 
<button>, <caption>, <cite>, <dd>, <del>, <dfn>, <div>, <dl>, <dt>, 
<em>, <fieldset>, <form>, <frame>, <frameset>, <h1> to <h6>, <hr>, <i>, 
<iframe>, <img>, <input>, <ins>, <kbd>, <label>, <legend>, <li>, 
<object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, <span>, 
<strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, 
<th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
button, checkbox, fileUpload, layer, frame, password, 
radio, reset, submit, text, textarea, window
ʵ 1
ڱУǽû뿪ʱִ JavaScript 룺
<html>
<head>
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value
document.getElementById("fname").value=x.toUpperCase()
}
</script>
</head>

<body>


<input type="text" id="fname" onblur="upperCase()" />

</body>
</html>

 
TIY
onblur
ʹ onblur ¼û뿪ʱִ JavaScript 429ݱı                          ġġݱı䡣



÷
onchange ¼ݸıʱ
﷨
onchange="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<input type="text">, <select>, <textarea>
ָ֧¼ JavaScript 
fileUpload, select, text, textarea
ʵ 1
ڱУǽûıʱִ JavaScript 룺
<html>
<head>
<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value
document.getElementById(x).value=y.toUpperCase()
}
</script>
</head>

<body>


<input type="text" id="fname" onchange="upperCase(this.id)" />

</body>
</html>

 
TIY
onchange
ʹ onchange ¼ûıʱִ JavaScript 429ûĳʱõ¼      ûĳʱõ¼


÷
onclick ¼ڶ󱻵ʱ
ע⣬ onclick  onmousedown ͬ¼ͬһԪϷ갴¼ַ֮ſ¼ʱŷġ
﷨
onclick="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <object>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, 
<strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, 
<thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
button, document, checkbox, link, radio, reset, submit
ʵ 1
ڱУťʱһеıᱻڶУ
<html>
<body>

Field1: <input type="text" id="field1" value="Hello World!">
<br />
Field2: <input type="text" id="field2">
<br /><br />
İť Field1 ݿ Field2 У
<br />
<button onclick="document.getElementById('field2').value=
document.getElementById('field1').value">Copy Text</button>

</body>
</html>

Field1: 
Field2: 
İť Field1 ݿ Field2 У
Copy Text
TIY
onclick
ʹ onclick429û˫ĳʱõ¼      ˫˫û˫ĳʱõ¼



÷
ondblclick ¼ڶ˫ʱ
﷨
ondblclick="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, 
<button>, <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, 
<em>, <fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, 
<kbd>, <label>, <legend>, <li>, <map>, <object>, <ol>, <p>, <pre>, 
<samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, 
<tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
document, link
ʵ 1
ڱУ˫ťʱڶݻݵһݶı䣺
<html>
<body>

Field1: <input type="text" id="field1" value="Hello World!">
<br />
Field2: <input type="text" id="field2">
<br /><br />
˫İť Field1 ݿ Field2 У
<br />
<button ondblclick="document.getElementById('field2').value=
document.getElementById('field1').value">Copy Text</button>

</body>
</html>

Field1: 
Field2: 
˫İť Field1 ݿ Field2 У
Copy Text
TIY
ondblclick
ʹ ondblclick

429ڼĵͼʱ              ڼĵͼʱ



÷
onerror ¼ĵͼعзʱ
װĵͼĹ˴󣬾ͻø¼
﷨
onerror="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<img>, <object>, <style>
ָ֧¼ JavaScript 
window, image
ʵ 1
ڱУװͼʱ˴ʾһԻ
<img src="image.gif" onerror="alert('The image could not be loaded.')" />
TIY
onerror
ʹ onerror429Ԫػý                            ýýԪػý㡣


÷
onfocus ¼ڶýʱ
﷨
onfocus="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <button>, 
<caption>, <cite>, <dd>, <del>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <frame>, <frameset>, <h1> to <h6>, <hr>, <i>, <iframe>, <img>, <input>, 
<ins>, <kbd>, <label>, <legend>, <li>, <object>, <ol>, <p>, <pre>, <q>, 
<samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <tbody>, 
<td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
button, checkbox, fileUpload, layer, frame, password, radio, reset, select, submit, 
text, textarea, window
ʵ
ڱУýʱ䱳ɫı䣺
<html>
<head>
<script type="text/javascript">
function setStyle(x)
{
document.getElementById(x).style.background="yellow"
}
</script>
</head>

<body>

First name: <input type="text"
onfocus="setStyle(this.id)" id="fname" />
<br />
Last name: <input type="text"
onfocus="setStyle(this.id)" id="lname" />

</body>
</html>

First name: 
Last name: 
TIY
onfocus
ʹ onfocus429ĳ̰                      ĳ̰¡


÷
onkeydown ¼ûһ̰ʱ
﷨
onkeydown="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, 
<button>, <caption>, <cite>, <code>, <dd>, <del>, <dfn>, <div>, <dt>, <em>, 
<fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, 
<span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, 
<th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
document, image, link, textarea
ʾע
죺Internet Explorer ʹ event.keyCode ȡرµַ Netscape/Firefox/Opera ʹ event.which
ʵ
ڱУû޷м֣
<html>
<body>
<script type="text/javascript">
function noNumbers(e)
{
var keynum
var keychar
var numcheck

if(window.event) // IE
  {
  keynum = e.keyCode
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which
  }

keychar = String.fromCharCode(keynum)
numcheck = /\d/
return !numcheck.test(keychar)
}
</script>

<form>
<input type="text" onkeydown="return noNumbers(event)" />
</form>

</html>


TIY
onkeydown
ʹ onkeydown429ĳ̰²ɿ                ĳ̰²ɿ


÷
onkeypress ¼ڼ̰²ͷһʱ
﷨
onkeypress="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, 
<button>, <caption>, <cite>, <code>, <dd>, <del>, <dfn>, <div>, <dt>, <em>, 
<fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, 
<span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, 
<th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
document, image, link, textarea
ʾע
죺Internet Explorer ʹ event.keyCode ȡرµַ Netscape/Firefox/Opera ʹ event.which
ʵ
ڱУû޷м֣
<html>
<body>
<script type="text/javascript">
function noNumbers(e)
{
var keynum
var keychar
var numcheck

if(window.event) // IE
  {
  keynum = e.keyCode
  }
else if(e.which) // Netscape/Firefox/Opera
  {
  keynum = e.which
  }
keychar = String.fromCharCode(keynum)
numcheck = /\d/
return !numcheck.test(keychar)
}
</script>

<form>
<input type="text" onkeypress="return noNumbers(event)" />
</form>

</html>


TIY
onkeypress
ʹ onkeypress
429ĳ̰ɿ                      ɼɼĳ̰ɿ



÷
onkeyup ¼ڼ̰ɿʱ
﷨
onkeyup="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, 
<button>, <caption>, <cite>, <code>, <dd>, <del>, <dfn>, <div>, <dt>, <em>, 
<fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, 
<span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, 
<th>, <thead>, <tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
document, image, link, textarea
ʵ
емַʱַᱻΪдһأ
<html>

<head>
<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value
document.getElementById(x).value=y.toUpperCase()
}
</script>
</head>

<body>
	
 <input type="text" id="fname" onkeyup="upperCase(this.id)" />

</body>
</html>

 
TIY
onkeyup
ʹ onkeyup429һҳһͼɼ              һҳһͼɼء


÷
onload ¼ҳͼɺ
﷨
onload="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<body>, <frame>, <frameset>, <iframe>, <img>, <link>, <script>
ָ֧¼ JavaScript 
image, layer, window
ʵ
ڱУı "Page is loaded" ᱻʾ״̬У
<html>
<head>
<script type="text/javascript">
function load()
{
window.status="Page is loaded"
}
</script>
</head>

<body onload="load()">
</body>

</html>
TIY
onload
ʹ onload ҳɼʱ״̬ʾһı
429갴ť                          갴ť¡



÷
onmousedown ¼갴ʱ
﷨
onmousedown="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
<tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
button, document, link
ʵ
ڱУͼƬʱᵯһԻ
<img src="/i/example_mouse2.jpg" 
onmousedown="alert('You clicked the picture!')" />
ͼƬ

ʵ 2
ڱУԻʾԪصıǩ
<html>
<head>
<script type="text/javascript">
function whichElement(e)
{
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head>

<body onmousedown="whichElement(event)">

<h2>This is a header</h2>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" alt="Ball">

</body>
</html>
TIY
onmousedown
ʹ onmousedown ͼ񱻵ʱʾһԻ
onmousedown 2
ʹ onmousedown ʾԪصıǩ429걻ƶ                              ơơ걻ƶ


÷
onmousemove ¼ָƶʱ
﷨
onmousemove="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
<tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
onmousemove is, by default, not an event of any object, 
because mouse movement happens very frequently.
ʾע
עͣÿûƶһأͻᷢһ mousemove ¼ķϵͳԴȥЩ mousemove ¼ʹø¼
ʵ
УûƶͼʱʾһԻ
<img src="/i/eg_mouse2.jpg" alt="mouse"
onmousemove="alert('ղžͼƬ')" />
(ŵͼƬ)

TIY
onmousemove
ʹ onmousemove
429ĳԪ뿪                        ĳԪƿ



÷
onmouseout ¼ָƳָĶʱ
﷨
onmouseout="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
<tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
layer, link
ʵ 1
УǽָƳͼʱʾһԻ
<img src="/i/example_mouse2.jpg" alt="mouse"
onmousemove="alert('ղ뿪ͼƬ')" />
(ͼƬƿ):
Visit W3School!
ʵ 2
УǽҳһӰťͼȻǻ onMouseOver  onMouseOut ¼Ϳ JavaScript лͼ
<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.getElementById('b1').src ="/i/eg_mouse.jpg"
}
function mouseOut()
{
document.getElementById('b1').src ="/i/eg_mouse2.jpg"
}
</script>
</head>

<body>
<a href="http://www.w3school.com.cn" 
onmouseover="mouseOver()" onmouseout="mouseOut()">
<img alt="Visit W3School!" src="/i/example_mouse2.jpg" id="b1" />
</a>
</body>
</html>

 Visit W3School!
TIY
onmouseout
ʹ onmouseout429ƵĳԪ֮                      󵽡󵽡ƵĳԪ֮ϡ



÷
onmouseover ¼ָƶָĶʱ
﷨
onmouseover="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
<tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
layer, link
ʵ 1
УǽûָƶͼʱʾһԻ
<img src="/i/eg_mouse2.jpg" alt="mouse"
onmouseover="alert('ͼƬϣ')" />
(ƶͼƬ):
Visit W3School!
ʵ 2
УǽҳһӰťͼȻǻ onMouseOver  onMouseOut ¼Ϳ JavaScript лͼ
<html>
<head>
<script type="text/javascript">
function mouseOver()
{
document.getElementById('b1').src ="/i/eg_mouse.jpg"
}
function mouseOut()
{
document.getElementById('b1').src ="/i/eg_mouse2.jpg"
}
</script>
</head>

<body>
<a href="http://www.w3school.com.cn" 
onmouseover="mouseOver()" onmouseout="mouseOut()">
<img alt="Visit W3School!" src="/i/eg_mouse2.jpg" id="b1" />
</a>
</body>
</html>

 Visit W3School!
TIY
onmouseover
ʹ onmouseover429갴ɿ                          ɡɡ갴ɿ



÷
onmouseup ¼갴ɿʱ
﷨
onmouseup="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, 
<caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, 
<form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, 
<li>, <map>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, 
<sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, 
<tr>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
button, document, link
ʵ 1
ڱУڵͼƬɿ갴󣬽ʾһԻ
<img src="/i/eg_mouse2.jpg" alt="mouse"
onmouseup="alert('ͼƬ')" />
(ͼƬ)
Visit W3School!
ʵ 2
ڱУԻлʾԪصıǩ
<html>
<head>
<script type="text/javascript">
function whichElement(e)
{
var targ
if (!e) var e = window.event
if (e.target) targ = e.target
else if (e.srcElement) targ = e.srcElement
if (targ.nodeType == 3) // defeat Safari bug
targ = targ.parentNode
var tname
tname=targ.tagName
alert("You clicked on a " + tname + " element.")
}
</script>
</head>

<body onmouseup="whichElement(event)">

<h2>This is a header</h2>
<p>This is a paragraph</p>
<img border="0" src="ball16.gif" alt="Ball">

</body>
</html>
TIY
onmouseup
ʹ onmouseup ͼ񱻵ʱʾһԻ
onmouseup 2
ʹ onmouseup ʾԪصıǩ429ðť                          ááðť



÷
onreset ¼ڱеðťʱ
﷨
onreset="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<form>
ָ֧¼ JavaScript 
form
ʵ
ڱУðťʱΪĬֵʾһԻ
<form onreset="alert('The form will be reset')">

Firstname: <input type="text" name="fname" value="John" />
<br />
Lastname: <input type="text" name="lname" />
<br /><br />
<input type="reset" value="Reset">

</form>

Firstname: 
Lastname: 

TIY
onreset
ʹ onreset  reset ¼ʱʾһԻ򡣡429ڻܱµС                ߴıߴıڻܱµС


÷
onresize ¼ڴڻܱСʱ
﷨
onresize="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<a>, <address>, <b>, <big>, <blockquote>, <body>, <button>, <cite>, <code>, 
<dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, <form>, <frame>, <h1> to <h6>,
<hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, <li>, <object>, <ol>, <p>, 
<pre>, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, 
<textarea>, <tt>, <ul>, <var>
ָ֧¼ JavaScript 
window
ʵ
ڱУûͼڵĴСʱʾһԻ
<body onresize="alert('You have changed the size of the window')">
</body>
TIY
onresize
ʹ onresize ڴڱСʱʾһԻ򡣡429ıѡ                              ѡСѡСıѡС


÷
onselect ¼ıеıѡʱ
﷨
onselect="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<input type="text">, <textarea>
ָ֧¼ JavaScript 
window
ʵ
ڱУûͼѡıеıʱʾһԻ
<form>

Select text: <input type="text" value="Hello world!"
onselect="alert('You have selected some of the text.')" />
<br /><br />
Select text: <textarea cols="20" rows="5"
onselect="alert('You have selected some of the text.')">
Hello world!</textarea>

</form>

Select text: 
Select text: 
TIY
onselect
ʹ onselect429ȷϰť                          ȷϡȷϡȷϰť


÷
onsubmit ¼ڱеȷϰťʱ
﷨
onsubmit="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<form>
ָ֧¼ JavaScript 
form
ʵ
ڱУûύťʱʾһԻ
<form name="testform" action="jsref_onsubmit.asp"
onsubmit="alert('Hello ' + testform.fname.value +'!')">

What is your name?<br />
<input type="text" name="fname" />
<input type="submit" value="Submit" />

</form>

What is your name?


TIY
onsubmit
ʹ onsubmit429û˳ҳ                            ˳˳û˳ҳ档


÷
onunload ¼û˳ҳʱ
﷨
onunload="SomeJavaScriptCode"
	
SomeJavaScriptCode	衣涨¼ʱִе JavaScript
ָ֧¼ HTML ǩ
<body>, <frameset>
ָ֧¼ JavaScript 
window
ʵ
ڱУҳرʱʾһԻ
<body onunload="alert('The onunload event was triggered')">
</body>
TIY
onunload
ʹ onunload429ص¼ʱALTǷ񱻰         ALTALTص¼ʱ&quot;ALT&quot; Ƿ񱻰¡



÷
altKey ¼Էһֵָʾָ¼ʱAlt Ƿ񱻰²סˡ
﷨
event.altKey=true|false|1|0
ʵ
ӿʾ갴ʱ "ALT" Ƿѱס
<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
  if (event.altKey==1)
    {
    alert("The ALT key was pressed!")
    }
  else
    {
    alert("The ALT key was NOT pressed!")
    }
  }
</script>
</head>

<body onmousedown="isKeyPressed(event)">

<p>Click somewhere in the document.
An alert box will tell you if you 
pressed the ALT key or not.</p>

</body>
</html>
TIY
altKey
 ALT Ƿѱס429ص¼ʱĸ갴ť    ص¼ʱĸ갴ť



÷
button ¼Կɷһָʾ¼ʱĸ갴
﷨
event.button=0|1|2
	
0	涨
1	涨м
2	涨Ҽ
Internet Explorer ӵвͬĲ
	
1	涨
4	涨м
2	涨Ҽ
ʾע
עͣڹֵãĲǵߵġ
ʾMozilla  CtrlCClick  2 ȼһ
ʵ
The following example alerts which mouse button was clicked:
<html>
<head>
<script type="text/javascript">
function whichButton(event)
  {
    if (event.button==2)
      {
      alert("You clicked the right mouse button!")
      }
    else
      {
      alert("You clicked the left mouse button!")
      }
  }
</script>
</head>

<body onmousedown="whichButton(event)">
	
<p>Click in the document. An alert box will 
alert which mouse button you clicked.</p>

</body>
</html>
TIY
button
ĸˡ429ص¼ʱָˮƽ    XXص¼ʱָˮƽꡣ



÷
clientX ¼Էص¼ʱָҳ棨ͻˮƽꡣ
ͻָǵǰڡ
﷨
event.clientX
ʾע
עͣ2  DOM ûṩѴתΪĵı׼ IE ʹ window.pageXOffset  window.pageYOffset ɡ
ʵ
ӿʾ¼ʱָ꣺
<html>
<head>
<script type="text/javascript">
function show_coords(event)
  {
  x=event.clientX
  y=event.clientY
  alert("X coords: " + x + ", Y coords: " + y)
  }
</script>
</head>

<body onmousedown="show_coords(event)">
	
	<p>Click in the document. An alert box will alert 
the x and y coordinates of the mouse pointer.</p>

</body>
</html>
TIY
clientX
ʾָꡣ

429ص¼ʱָĴֱ    YYص¼ʱָĴֱꡣ



÷
clientY ¼Էص¼ʱָҳ棨ͻĴֱꡣ
ͻָǵǰڡ
﷨
event.clientY
ʾע
עͣע⣬겻ĵĹ¼ڴڵĶĵ˶ԶclientY ֵ 0ǣ2  DOM ûṩѴתΪĵı׼ IE ʹ window.pageXOffset  window.pageYOffset ɡ
ʵ
ӿʾ¼ʱָ꣺
<html>
<head>
<script type="text/javascript">
function show_coords(event)
  {
  x=event.clientX
  y=event.clientY
  alert("X coords: " + x + ", Y coords: " + y)
  }
</script>
</head>

<body onmousedown="show_coords(event)">
	
<p>Click in the document. An alert box will alert 
the x and y coordinates of the mouse pointer.</p>

</body>
</html>
TIY
clientY
ʾָꡣ429ص¼ʱCTRLǷ񱻰      CTRLCTRLص¼ʱCTRLǷ񱻰¡



÷
ctrlKey ¼Կɷһֵָʾ¼ʱCtrl Ƿ񱻰²ס
﷨
event.ctrlKey=true|false|1|0
ʵ
ӿʾ갴ʱ "CTRL" Ƿ񱻰ס
<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
  if (event.ctrlKey==1)
    {
    alert("The CTRL key was pressed!")
    }
  else
    {
    alert("The CTRL key was NOT pressed!")
    }
  }
</script>
</head>

<body onmousedown="isKeyPressed(event)">
	
	<p>Click somewhere in the document.
An alert box will tell you if you 
pressed the CTRL key or not.</p>

</body>
</html>
TIY
ctrlKey
 CTRL Ƿ񱻰ˡ


429ص¼ʱmetaǷ񱻰      metametaص¼ʱmetaǷ񱻰¡



÷
metaKey ¼Կɷһֵָʾ¼ʱ"meta" Ƿ񱻰²ס
﷨
event.metaKey
ʵ
ӿʾ갴ʱ "meta" Ƿ񱻰ס
<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
  if (event.metaKey==1)
    {
    alert("The meta key was pressed!")
    }
  else
    {
    alert("The meta key was NOT pressed!")
    }
  }
</script>
</head>

<body onmousedown="isKeyPressed(event)">
	
<p>Click somewhere in the document.
An alert box will tell you if you 
pressed the meta key or not.</p>

</body>
</html>
TIY
metakey
 meta Ƿ񱻰ס֧ IE429¼ĿڵصĽڵ          ؽڡؽڡ¼ĿڵصĽڵ㡣


÷
relatedTarget ¼Է¼ĿڵصĽڵ㡣
 mouseover ¼˵ָƵĿڵʱ뿪Ǹڵ㡣
 mouseout ¼˵뿪ĿʱָĽڵ㡣
͵¼˵ûá
﷨
event.relatedTarget
ʵ
ӿɷָո뿪Ԫأ
<html>
<head>
<script type="text/javascript">
function getRelElement(event)
  {
  var txt="The cursor just exited the ";
  txt=txt + event.relatedTarget.tagName + " element.";
  alert(txt);
  }
</script>
</head>
<body>

<p onmouseover="getRelElement(event)">
Mouse over this paragraph.</p>

</body>
</html>
TIY
relatedtarget
ָո뿪Ԫأ֧ IE429صĳ¼ʱˮƽ      XXصĳ¼ʱָˮƽꡣ


÷
screenX ¼Կɷ¼ʱָĻˮƽꡣ
﷨
event.screenX
ʵ
ӿʾ¼ʱָ꣺
<html>
<head>
<script type="text/javascript">
function show_coords(event)
  {
  x=event.screenX
  y=event.screenY
  alert("X coords: " + x + ", Y coords: " + y)
  }
</script>
</head>
<body onmousedown="show_coords(event)">

<p>Click in the document. An alert box will alert 
the x and y coordinates of the cursor.</p>

</body>
</html>
TIY
screenX
ʾָꡣ429صĳ¼ʱ괹ֱ      YYصĳ¼ʱָĴֱꡣ



÷
screenY ¼Կɷ¼ʱָĻĴֱꡣ
﷨
event.screenY
ʵ
ӿʾ¼ʱָ꣺
<html>
<head>
<script type="text/javascript">
function show_coords(event)
  {
  x=event.screenX
  y=event.screenY
  alert("X coords: " + x + ", Y coords: " + y)
  }
</script>
</head>
<body onmousedown="show_coords(event)">

<p>Click in the document. An alert box will alert 
the x and y coordinates of the cursor.</p>

</body>
</html>
TIY
screenY
ʾָꡣ429ص¼ʱSHIFTǷ񱻰     SHIFTSHIFTص¼ʱSHIFTǷ񱻰¡



÷
shiftKey ¼Կɷһֵָʾ¼ʱ"SHIFT" Ƿ񱻰²ס
﷨
event.shiftKey=true|false|1|0
ʵ
ӿʾ갴ʱ "SHIFT" Ƿ񱻰ס
<html>
<head>
<script type="text/javascript">
function isKeyPressed(event)
{
  if (event.shiftKey==1)
    {
    alert("The shift key was pressed!")
    }
  else
    {
    alert("The shift key was NOT pressed!")
    }
  }
</script>
</head>

<body onmousedown="isKeyPressed(event)">
	
<p>Click somewhere in the document.
An alert box will tell you if you 
pressed the shift key or not.</p>

</body>
</html>
TIY
shiftKey
 SHIFT Ƿ񱻰ס429زֵָʾ¼Ƿ¼    ݡݡزֵָʾ¼Ƿ¼͡



÷
bubbles ¼Էһֵ¼ͣ򷵻 true򷵻 fasle
﷨
event.bubbles
¼
 2  DOM У¼Ϊ׶Σ
һ׶Ρ¼ Document ĵ´ݸĿڵ㡣Ŀκһȱרע˲¼ô¼Щ
ڶ׶ηĿڵֱעĿϵʺϵ¼С 0 ¼ģṩ¼ơ
ݽ׶Ρڴ˽׶Σ¼ĿԪϴػݻ Document ĵΡ
ʵ
ӿɼⷢ¼Ƿһ¼
<html>
<head>

<script type="text/javascript">
function getEventType(event)
  { 
  alert(event.bubbles);
  }
</script>
</head>

<body onmousedown="getEventType(event)">

<p>Click somewhere in the document. 
An alert box will tell if the event is a bubbling event.</p>

</body>
</html>
TIY
bubbling event
¼Ƿ¼IE ֧֣429زֵָʾ¼ǷȡĬ϶    ȡȡزֵָʾ¼ǷӵȡĬ϶


÷
cancelable ¼һֵ preventDefault() ȡ¼Ĭ϶Ϊ trueΪ fasle
﷨
event.cancelable
ʵ
ӽⷢ¼Ƿһ cancelable ¼
<html>
<head>

<script type="text/javascript">
function isEventCancelable(event)
  { 
  alert(event.cancelable);
  }
</script>
</head>

<body onmousedown="isEventCancelable(event)">
	
<p>Click somewhere in the document. 
An alert box will tell if the 
event is a cancelable event.</p>

</body>
</html>
TIY
cancelable event
¼Ƿ cancelable ¼IE ֧֣429¼¼Ԫ        ԪءԪء¼¼Ԫء



÷
currentTarget ¼Է¼Ľڵ㣬ǰ¼Ԫءĵ򴰿ڡ
ڲݽ׶ΣǷǳõģΪڵ㣬ͬ target ԡ
﷨
event.currentTarget
ʵ
ӿɻĸԪصļ¼
<html>
<head>

<script type="text/javascript">
function getEventTrigger(event)
  { 
  x=event.currentTarget; 
  alert("The id of the triggered element: "
  + x.id);
  }
</script>
</head>

<body >

<p id="p1" onmousedown="getEventTrigger(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>

</body>
</html>
TIY
currenttarget event
¼ǸԪء429¼ĵǰ׶                  ǰ׶Ρǰ׶Ρ¼ĵǰ׶Ρ



÷
eventPhase Է¼ĵǰ׶Ρֵ֮һǷֱʾ׶Ρ¼ɷݽ׶Ρ
eventPhase 
	ֵ
Event.CAPTURING_PHASE	1
Event.AT_TARGET 	2
Event.BUBBLING_PHASE	3
429ش¼Ԫأ¼Ŀڵ    δδش¼Ԫأ¼Ŀڵ㣩




÷
target ¼Կɷ¼Ŀڵ㣨¼Ľڵ㣩¼Ԫءĵ򴰿ڡ
﷨
event.target
ʵ
ӿɻô¼Ԫأ
<html>
<head>

<script type="text/javascript">
function getEventTrigger(event)
  { 
  x=event.target; 
  alert("The id of the triggered element: "
  + x.id);
  }
</script>

</head>
<body >

<p id="p1" onmousedown="getEventTrigger(event)">
Click on this paragraph. An alert box will
show which element triggered the event.</p>

</body>
</html>
TIY
target event
ô¼ԪأIE ֧֣429¼ɵںʱ                ¼ʱ¼ʱ¼ɵںʱ䡣



÷
timeStamp ¼Կɷһʱָʾ¼ںʱ䣨 epoch ʼĺ
epoch һ¼ο㡣ǿͻʱ䡣
ϵͳṩϢˣtimeStamp ԲǶϵͳ/¼ǿõġ
﷨
event.timeStamp
ʵ
ӿɻϵͳʼ¼
<html>
<head>
<script type="text/javascript">
function showTimestamp(event)
  {
  var minutes = 1000*60
  x=event.timeStamp;
  alert(x/minutes)
  }
</script>
</head>

<body onmousedown="showTimestamp(event)">

<p>Click in the document. An alert 
box will alert the timestamp.</p>

</body>
</html>
TIY
timestamp event
ϵͳķIE ֧֣429صǰEventʾ¼       ͡͡صǰ Event ʾ¼ơ



÷
type ¼Էط¼ͣǰ Event ʾ¼ơ
ע¼ͬ¼ɾǰ׺ "on"  "submit""load"  "click"
﷨
event.type
ʵ
ӿɷر¼ͣ
<html>
<head>
<script type="text/javascript">
function getEventType(event)
  { 
  alert(event.type);
  }
</script>
</head>

<body onmousedown="getEventType(event)">

<p>Click somewhere in the document.
An alert box will tell what event 
type you triggered.</p>

</body>
</html>
TIY
type event
ر¼ͣIE ֧֣429ʼ´Event()         ʼʼʼ´ Event ԡ


÷
ʼ¼
﷨
event.initEvent(eventType,canBubble,cancelable)
	
eventType	ֵַ¼͡
canBubble	¼Ƿݡ
cancelable	Ƿ preventDefault() ȡ¼
˵
÷ʼ Document.createEvent() ĺϳ Event  type ԡbubbles Ժ cancelable ԡֻ´ Event  Document  Element  dispatchEvent() ֮ǰܵ Event.initEvent() 429֪ͨҪִ¼Ĭ϶()  ȡȡ֪ͨҪִ¼Ĭ϶


÷
ȡ¼Ĭ϶
﷨
event.preventDefault()
˵
÷֪ͨ Web Ҫִ¼Ĭ϶Ķ磬 type  "submit"¼׶οԵ¼ͨø÷ֹύע⣬ Event Ŀȡ fasleôûĬ϶ֹ߲Ĭ϶ø÷ûá429ɷ¼()                          ֹɡֹɡɷ¼


÷
ɷ¼
ֹ¼ڴ̵ĲĿ괦ݽ׶νһø÷󣬸ýڵϴ¼Ĵ򽫱ã¼ٱɵڵ㡣
﷨
event.stopPropagation()
˵
÷ֹͣ¼Ĵֹɵ Document ڵ㡣¼κν׶ζԵע⣬Ȼ÷ֹͬһ Document ڵϵ¼ãֹ¼ɵڵ㡣345Form 
Form һ HTML 
 HTML ĵ <form> ÿһΣForm ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.471Ԫصۼϣ        ԪءԪءԪص顣



÷
elements ϿɷذԪص顣
Ԫгֵ˳ڱHTML Դгֵ˳ͬ
ÿԪضһ type ԣֵַ˵Ԫص͡
﷨
formObject.elements[].property
ʾע
ʾ elements[] ƣinput ǩ id  name ԣôԪصƾ formObject һԣ˿ʹƶ input 
 x һ form еһ input  fnameʹ x.fname øö
ʵ
бԪصֵͣ
<html>
<body>

<form id="myForm">
Firstname: <input id="fname" type="text" value="Mickey" />
Lastname: <input id="lname" type="text" value="Mouse" />
<input id="sub" type="button" value="Submit" />
</form>

<p>Get the value of all the elements in the form:<br />
<script type="text/javascript">
var x=document.getElementById("myForm");
for (var i=0;i<x.length;i++)
  {
  document.write(x.elements[i].value);
  document.write("<br />");
  document.write(x.elements[i].type);
  document.write("<br />");
  }
</script>
</p>

</body>
</html>
TIY
ȡбԪصֵ͡471ɽַܵ                    ɽַɽַɽַܵ


÷
acceptCharset Կû򷵻һŷָбǷɽַܵ
﷨
formObject.acceptCharset=charset
ʵ
ʾݿַܵ
<html>
<head>
<script type="text/javascript">
function showCharset()
  {
  var x=document.getElementById("myForm")
  alert(x.acceptCharset)
  }
</script>
</head>
<body>

<form id="myForm" acceptCharset="ISO-8859-1">
Text: <input type="text" value="Hello World!">
<input type="button" onclick="showCharset()"
value="Show charset">
</form>

</body>
</html>
TIY
ȡñݿַܵ471û򷵻رaction              ĿַĿַû򷵻ر action ԡ



÷
action Կû򷵻ر action ԡ
action Զ˵ύʱݱδ
﷨
formObject.action=URL
ʵ
ӿɸı action URL
<html>
<head>
<script type="text/javascript">
function changeAction()
  {
  var x=document.getElementById("myForm")
  alert("Original action: " + x.action)
  x.action="index.asp"
  alert("New action: " + x.action)
  x.submit()
  }
</script>
</head>
<body>

<form id="myForm" action="js_examples.asp">
Name: <input type="text" value="Mickey Mouse" />
<input type="button" onclick="changeAction()"
value="Change action attribute and submit form" />
</form>

</body>
</html>
TIY
ı action ԡ471û򷵻رݵMIME    ݱݱû򷵻رݵ MIME ͡



÷
enctype Կû򷵻ڱݵ MIME ͡
û enctype ԣôύıʱĬֵ "application/x-www-form-urlencoded"
 input type  "file" ʱֵ "multipart/form-data"
﷨
formObject.encoding=encoding
ʵ
ӿɷرıͣ
<html>
<head>
<script type="text/javascript">
function showEnctype()
  {
  var x=document.getElementById("myForm")
  alert(x.enctype)
  }
</script>
</head>
<body>

<form id="myForm" enctype="application/x-www-form-urlencoded">
Name: <input type="text" value="Mickey Mouse" />
<input type="button" onclick="showEnctype()"
value="Show enctype" />
</form>

</body>
</html>
TIY
ȡñı͡471û򷵻رid                      ididû򷵻ر id


÷
id Կû򷵻ر id
﷨
formObject.id=id
ʵ
չʾַ <form> Ԫص id ķ
<html>
<body>

<form id="myForm">
Text: <input type="text" size="20" value="Hello World" />
</form>

<script type="text/javascript">
x=document.getElementsByTagName('form')[0];
document.write("Form id: " + x.id);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('myForm').id);
</script>

</body>
</html>
TIY
 <form> Ԫȡ id471رеԪĿ                    ԪĿԪĿرеԪĿ


÷
length ԿɷرԪصĿ
﷨
formObject.length
ʵ
ӿɷرԪصĿ
<html>
<body>

<form id="myForm" method="get">
Name: <input type="text" size="20" value="Peter Griffin" /><br />
Text: <input type="text" size="20" value="Hello World" />
</form>

<script type="text/javascript">
document.write("Number of elements in myForm: ");
document.write(document.getElementById('myForm').length);
</script>

</body>
</html>
TIY
ȡñԪصĿ471û򷵻ؽݷ͵HTTP  η͡η͡û򷵻ؽݷ͵ HTTP 


÷
method Կû򷵻ڱύ HTTP 
﷨
formObject.method=get|post
ʵ
ӵĶԻʾ˷ͱʹõ HTTP 
<html>
<head>
<script type="text/javascript">
function showMethod()
  {
  var x=document.getElementById("myForm")
  alert(x.method)
  }
</script>
</head>
<body>

<form id="myForm" method="post">
Name: <input type="text" size="20" value="Mickey Mouse" />
<input type="button" onclick="showMethod()" value="Show method" />
</form>

</body>
</html>
TIY
ݵ HTTP 471û򷵻ر                    ơơû򷵻رơ



÷
name Կû򷵻رơ
﷨
formObject.name=formname
ʵ
ӿɷرƣ
<html>
<body>
<form id="myForm" method="get" name="myForm">
Name: <input type="text" size="20" value="Peter Griffin" />
</form>

<script type="text/javascript">
document.write("Form name: ");
document.write(document.getElementById('myForm').name);
</script>

</body>
</html>
TIY
ȡ <form> Ԫصơ471û򷵻رύFrameWindow δδû򷵻رύ Frame  Window 



÷
target Կû򷵻ںδ򿪱е action-URL
﷨
formObject.target=_blank|_parent|_self|_top 
ĸĿƣ
_blank - һµδĴĵ
_self - ͬĿܻ򴰿Ŀĵ
_parent - ĵ븸ڻ˳õĿܵĿܼ
_top - ĵóӵĴ,ȡκεǰڴʾĿ
ʵ
ӿһ´ڴ action-URL
<html>
<head>
<script type="text/javascript">
function submitForm()
  {
  var x=document.getElementById("myForm");
  x.target="_blank";
  x.submit();
  }
</script>
</head>
<body>

<form id="myForm" action="default.asp">
Name: <input type="text" value="Mickey Mouse" />
<input type="button" onclick="submitForm()"
value="Submit" />
</form>

</body>
</html>
TIY
ñ property ԡ471ѱԪΪǵĬֵ()ֵáֵáѱԪΪǵĬֵ



÷
reset() ɰѱеԪΪǵĬֵ
﷨
formObject.reset()
˵
ø÷Ľû Reset ťĽֻǱ¼ onreset ᱻá
ʵ
<html>
<head>
<script type="text/javascript">
function formReset()
  {
  document.getElementById("myForm").reset()
  }
</script>
</head>

<form id="myForm">
Name: <input type="text" size="20"><br />
Age: <input type="text" size="20"><br />
<br />
<input type="button" onclick="formReset()" value="Reset">
</form>
</body>

</html>
TIY
ñ471ύ()                              ύύύ



÷
submit() ѱύ Web 
﷨
formObject.submit()
˵
÷ύķʽû Submit ťһǱ onsubmit ¼ᱻá
ʵ
<html>
<head>
<script type="text/javascript">
function formSubmit()
  {
  document.getElementById("myForm").submit()
  }
</script>
</head>

<body>

<form id="myForm" action="js_form_action.asp" method="get">
Firstname: <input type="text" name="firstname" size="20"><br />
Lastname: <input type="text" name="lastname" size="20"><br />
<br />
<input type="button" onclick="formSubmit()" value="Submit">
</form>
</body>

</html>
TIY
ύ471ñԪ֮ǰ        ¼ááñԪ֮ǰá




÷
ñʱõĴ
﷨
form.onreset
˵
Form  onreset ָһ¼û˱е Reset ťύһʱͻ¼ע⣬Ϊ Form.reset() Ӧá onreset  fasleԪؾͲá471ύ֮ǰ            ¼ȷϡȷϡύ֮ǰá



÷
ύʱõ¼
﷨
form.onsubmit
˵
Form  onsubmit ָһ¼û˱е Submit ťύһʱͻ¼ע⣬÷Form.submit() ʱôᱻá
 onsubmit  fasleԪؾͲύúֵʲôûзأᱻύ
ʾע
ʾ onsubmit ȡύڽб֤ʮġ345ܡܡFrame 
Frame һ HTML ܡ
 HTML ĵ <frame> ÿһΣͻᴴһ Frame
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.485ɿܵݵĵ                    ĵĵɿܵݵĵ



÷
contentDocument  HTML 󷵻ؿɵĵ
ͨб׼ DOM صĶ
﷨
frameObject.contentDocument
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" src="frame_cdoc.htm">
    <frame id="rightFrame" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_cdoc.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_cdoc.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function showCDoc()
  {
  var x=parent.document.getElementById("leftFrame")
  alert(x.contentDocument.documentElement.tagName)
  }
</script>
</head>
<body>

<input type="button" onclick="showCDoc()"
value="Show content-document's first tag" />

</body>
</html>
TIY
Ϊ HTML Ŀĵ485û򷵻ǷʾΧı߿        ʾʾû򷵻ǷʾΧı߿



÷
frameBorder û򷵻ǷʾΧı߿
ϣֿܵı߿ѸΪ 0
﷨
frameObject.frameBorder=1|0
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
<frameset cols="50%,50%">
  <frame id="leftFrame" frameBorder="1"
  src="frame_frameborder.htm">
  <frame id="rightFrame" frameBorder="0" src="frame_a.htm" >
</frameset>
</html>
HTML ĵ "frame_frameborder.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_frameborder.htm" Դ룺
<html>
<body>

<script type="text/javascript">
x=parent.document.getElementById("leftFrame");
y=parent.document.getElementById("rightFrame");

document.write("Frame border for leftFrame is: ");
document.write(x.frameBorder);

document.write("<br />Frame border for rightFrame is: ");
document.write(y.frameBorder);
</script>

</body>
</html>
TIY
ؿܵ frameBorder ԡ485û򷵻ؿܵid                      ididû򷵻ؿܵ id


÷
id Կɷؿܵ id
﷨
frameObject.id=id
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
<frameset cols="50%,50%">
  <frame id="leftFrame" src="frame_id.htm">
  <frame id="rightFrame" src="frame_a.htm" >
</frameset>
</html>
HTML ĵ "frame_id.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_id.htm" Դ룺
<html>
<body>

<script type="text/javascript">
x=parent.document.getElementsByTagName("frame")[0];
y=parent.document.getElementsByTagName("frame")[1];


document.write("The id for the left frame is: ");
document.write(x.id);

document.write("<br />The id for the right frame is: ");
document.write(y.id);
</script>

</body>
</html>
TIY
ؿܵ id485û򷵻ָĵURL URL˵URL˵û򷵻ָĵ URL



÷
longDesc Կû򷵻һ URL
ʾôֿ֧ܵʹøԡ
﷨
frameObject.longDesc=URL
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" src="frame_longdesc.htm"
    longdesc="frame_description.htm">
    <frame id="rightFrame" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_longdesc.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_longdesc.htm" Դ룺
<html>
<body>

<script type="text/javascript">
x=parent.document.getElementById("leftFrame");

document.write("Description for this frame: ");
document.write('<a href="' + x.longDesc
+ '">Description</a>');
</script>

</body>
</html>
TIY
ʹ <frame> Ԫе longdesc 

485û򷵻ؿܵĶ͵ײҳհ        հסհסû򷵻ؿܵĶ͵ײҳհס



÷
marginHeight Կû򷵻ؿܵĶ͵ײҳհףΪλ
﷨
frameObject.marginHeight=pixels
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" marginheight="50"
    src="frame_marginheight.htm">
    <frame id="rightFrame" marginheight="100"
    src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_marginheight.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_marginheight.htm" Դ룺
<html>
<body>

script type="text/javascript">
x=parent.document.getElementById("leftFrame");
y=parent.document.getElementById("rightFrame");

document.write("Top/Bottom margins for leftFrame: ");
document.write(x.marginHeight);
document.write("<br />Top/Bottom margins for rightFrame: ");
document.write(y.marginHeight);
</script>

</body>
</html>
TIY
ؿܵĶ͵ײҳհס485û򷵻ؿܵԵұԵĿհ    հסհסû򷵻ؿܵԵұԵĿհס



÷
marginWidth Կû򷵻ؿܵԵұԵҳհףΪλ
﷨
frameObject.marginWidth=pixels
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" marginwidth="50"
    src="frame_marginwidth.htm">
    <frame id="rightFrame" marginwidth="20"
    src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_marginwidth.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_marginwidth.htm" Դ룺
<html>
<body>

script type="text/javascript">
x=parent.document.getElementById("leftFrame");
y=parent.document.getElementById("rightFrame");

document.write("Left/Right margins for leftFrame: ");
document.write(x.marginWidth);
document.write("<br />Left/Right margins for rightFrame: ");
document.write(y.marginWidth);
</script>

</body>
</html>
TIY
ؿܵҲĿհס485û򷵻ؿܵ                    ơơû򷵻ؿܵơ


÷
name Կû򷵻ؿܵơ
﷨
frameObject.name=name
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" name="toc" src="frame_name.htm">
    <frame id="rightFrame" name="main" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_name.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_name.htm" Դ룺
<html>
<body>

<script type="text/javascript">
x=parent.document.getElementById("leftFrame");
y=parent.document.getElementById("rightFrame");

document.write("The name of leftFrame is: ");
document.write(x.name);

document.write("<br />The name of rightFrame is: ");
document.write(y.name);
</script>

</body>
</html>
TIY
ؿܵơ485û򷵻ؿǷɵС            ɵɵû򷵻ؿǷɵС



÷
noResize Կû򷵻ǷɵܵĴС
﷨
frameObject.noResize=true|false
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" src="frame_noresize.htm">
    <frame id="rightFrame" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_noresize.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_noresize.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function disableResize()
  {
  parent.document.getElementById("leftFrame").noResize=true
  parent.document.getElementById("rightFrame").noResize=true
  }
function enableResize()
  {
  parent.document.getElementById("leftFrame").noResize=false
  parent.document.getElementById("rightFrame").noResize=false
  }
</script>
</head>

<body>
<input type="button" onclick="disableResize()" value="No resize" />
<input type="button" onclick="enableResize()" value="Resize" />
</body>

</html>
TIY
ɵСͲɵСĿܡ485û򷵻ؿǷӵй          ййû򷵻ؿǷӵй



÷
scrolling Կû򷵻ؿǷӵй
﷨
frameObject.scrolling=yes|no
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="leftFrame" src="frame_scroll.htm">
    <frame id="rightFrame" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_scroll.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_scroll.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function enableScrolling()
  {
  parent.document.getElementById("leftFrame").scrolling="yes"
  parent.document.getElementById("rightFrame").scrolling="yes"
  }
function disableScrolling()
  {
  parent.document.getElementById("leftFrame").scrolling="no"
  parent.document.getElementById("rightFrame").scrolling="no"
  }
</script>
</head>

<body>
<input type="button" onclick="enableScrolling()"
value="Scroll bars" />
<input type="button" onclick="disableScrolling()"
value="No scroll bars" />
</body>

</html>
TIY485û򷵻ӦصеĵURL   URLURLû򷵻Ӧصеĵ URL



÷
src Կû򷵻Ӧеĵ URL
ֻ HTML  <frame> ǵһӦ Window.location  Location 
﷨
frameObject.src=URL
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
  <frameset cols="50%,50%">
    <frame id="lFrame" src="frame_src.htm">
    <frame id="rFrame" src="frame_a.htm">
  </frameset>
</html>
HTML ĵ "frame_src.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_src.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function newSrc()
{
parent.document.getElementById("lFrame").src="http://w3school.com.cn"
parent.document.getElementById("rFrame").src="http://google.com"
}
</script>
</head>

<body>
<form>
<input type="button" onclick="newSrc()"
value="Change frame source" />
</form>
</body>

</html>
TIY
ܵԴ345ܼܼFrameset 
Frameset  HTML ܼ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.496û򷵻ؿܼеĿ              û򷵻ؿܼеĿ


÷
cols Կû򷵻ؿܼеĿͳߴ硣
ɶŷָػٷֱбеĿͿȣ
﷨
framesetObject.cols=col1,col2,col3....
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
<frameset cols="50%,50%">
  <frame src="frame_cols.htm">
  <frame src="frame_a.htm">
</frameset>
</html>
HTML ĵ "frame_cols.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_cols.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function changeCols()
  {
  parent.document.getElementById("main").cols="30%,70%"
  }
  
function restoreCols()
  {
  parent.document.getElementById("main").cols="50%,50%"
  }
</script>
</head>
<body>

<input type="button" onclick="changeCols()"
value="Change column size" />
<input type="button" onclick="restoreCols()"
value="Restore column size" />

</body>
</html>
TIY
Ŀܼгߴ
496û򷵻ؿܼid                    ididû򷵻ؿܼ id



÷
id Կû򷵻ؿܼ id
﷨
framesetObject.id=id
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
<frameset id="main" cols="50%,50%">
  <frame id="leftFrame" src="frame_frameset_id.htm">
  <frame id="rightFrame" src="frame_a.htm" >
</frameset>
</html>
HTML ĵ "frame_frameset_id.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_frameset_id.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function showFrameId()
  {
  var txt="Frameset Id: "
  txt=txt + parent.document.getElementById("main").id
  alert(txt)
  }
</script>
</head>
<body>

<input type="button" onclick="showFrameId()"
value="Show Frameset Id" />

</body>
</html>
TIY
ȡ <frameset> Ԫص id496û򷵻ؿܼеĿ              û򷵻ؿܼеĿ



÷
rows Կû򷵻ؿеĿͳߴ硣
ɶŷָػٷֱбеĿ͸߶ȣ
﷨
framesetObject.rows=row1,row2,row3....
ʵ
ǵУȽеĿܼ HTML ĵÿΪڵ 50%
<html>
<frameset rows="50%,50%">
  <frame src="frame_rows.htm">
  <frame src="frame_a.htm">
</frameset>
</html>
HTML ĵ "frame_rows.htm" һУ HTML ĵ "frame_a.htm" ڶС
 "frame_rows.htm" Դ룺
<html>
<head>
<script type="text/javascript">
function changeRows()
  {
  parent.document.getElementById("main").rows="30%,70%"
  }

function restoreRows()
  {
  parent.document.getElementById("main").rows="50%,50%"
  }
</script>
</head>
<body>

<form>
<input type="button" onclick="changeRows()"
value="Change row size" />
<input type="button" onclick="restoreRows()"
value="Restore row size" />
</form>

</body>
</html>
TIY
Ŀܼгߴ345ܡܡIFrame 
IFrame һ HTML ܡ
 HTML ĵ <iframe> ÿһΣһ IFrame ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.500Χ iframe               Χ iframe



÷
align Կû򷵻θΧı iframe
﷨
iframeObject.align=left|right|top|middle|bottom
ʵ
ӽ iframe ݻıеҲࣺ
<html>
<body>

<iframe src="frame_a.htm" id="frame1"></iframe>

<p>Some text. Some text. Some text. Some text.</p>

<script type="text/javascript">
document.getElementById("frame1").align="right";
</script>

</body>
</html>
TIY
 <iframe> зʽ500ɿݵĵ                      ĵĵɿܵݵĵ



÷
contentDocument ܹ HTML  iframe еĵ
ͨб׼ DOM صĶ
﷨
iframeObject.contentDocument
ʵ
ӿɴ iframe ĵĵһ <h2> Ԫȡı
<html>
<head>
<script type="text/javascript">
function getTextNode()
{
var x=document.getElementById("frame1").contentDocument;
alert(x.getElementsByTagName("h2")[0].childNodes[0].nodeValue);
}
</script>
</head>

<body>
<iframe src="frame_a.htm" id="frame1"></iframe>
<br /><br />
<input type="button" onclick="getTextNode()" value="Get text" />

</body>
</html>
TIY
 iframe ĵȡıڵ500û򷵻ǷʾiframeΧ߿        ʾʾû򷵻Ƿʾ iframe Χı߿



÷
frameBorder Կû򷵻Ƿʾ iframe Χı߿
ѸΪ 0Իޱ߿Ŀܡ
﷨
iframeObject.frameBorder=1|0
ʵ
 iframe Ƿӵб߿
<html>
<head>
<script type="text/javascript">
function removeBorder()
  {
  document.getElementById("frame1").frameBorder="0";
  }
function restoreBorder()
  {
  document.getElementById("frame1").frameBorder="1";
  }
</script>
</head>
<body>

<iframe src="frame_a.htm" id="frame1"></iframe>
<br /><br />
<input type="button" onclick="removeBorder()"
value="Remove border" />
<input type="button" onclick="restoreBorder()"
value="Restore border" />

</body>
</html>
TIY
 iframe ı߿500û򷵻 iframe ĸ߶                ȫߡȫߡû򷵻 iframe ĸ߶ȡ



÷
height Կû򷵻 iframe ĸ߶ȣػٷֱΪλ
﷨
iframeObject.height=pixels
ʵ
ӿɸ iframe ĸ߶ȣ
<html>
<head>
<script type="text/javascript">
function changeHeight()
  {
  document.getElementById("frame1").height="200";
  }
</script>
</head>
<body>

<iframe src="frame_a.htm" id="frame1" height="100"></iframe>
<br /><br />

<input type="button" onclick="changeHeight()"
value="Change height" />

</body>
</html>
TIY
 iframe ĸ߶ȺͿȡ500û򷵻 iframe  id                 ididû򷵻 iframe  id



÷
id Կû򷵻 iframe  id
﷨
iframeObject.id=id
ʵ
չʾַ iframe  id ķ
<html>
<body>

<iframe src="frame_a.htm" id="frame1"></iframe>
<br /><br />

<script type="text/javascript">
document.write("The iframe's id: ");
document.write(document.getElementsByTagName("iframe")[0].id);
document.write("<br /><br />");

document.write("An alternate way: ");
document.write("<br />");
document.write("The iframe's id: ");
document.write(document.getElementById("frame1").id);
</script>

</body>
</html>
TIY
 <iframe> Ԫص id500û򷵻iframeݵĵ URL    URL˵URL˵û򷵻  iframe ݵĵ URL



÷
longDesc Կû򷵻ذ iframe ĵ URL
ʾѸڲֿ֧ܵ
﷨
iframeObject.longDesc=URL
ʵ
Ӵһָһҳӣ
<html>
<body>
<iframe src="frame_a.htm" id="frame1"
longdesc="frame_description.htm"></iframe>
<br />

<script type="text/javascript">
x=document.getElementById("frame1");
document.write("Description for frame contents: ");
document.write('<a href="' + x.longDesc + '">Description</a>');
</script>

</body>
</html>
TIY
ʹ <iframe> Ԫе longdesc 

500û򷵻iframe͵ײҳհ      հסհסû򷵻 iframe Ķ͵ײҳհס



÷
marginHeight Կû򷵻ؿܶ͵ײҳհףؼƣ
﷨
iframeObject.marginHeight=pixels
ʵ
ӿɷ iframe ͵ײҳհף
<html>
<body>
<iframe src="frame_a.htm" id="frame1" marginheight="50"></iframe>
<br />

<script type="text/javascript">
x=document.getElementById("frame1");
document.write("Top and bottom margins of the iframe are: ");
document.write(x.marginHeight);
</script>

</body>
</html>
TIY
 iframe Ķ͵ײҳհס500û򷵻iframeҲҳհ      հסհסû򷵻 iframe Ҳҳհס


÷
marginWidth Կû򷵻ؿܵҲԵҳհףΪλ
﷨
iframeObject.marginWidth=pixels
ʵ
ӽ iframe ԵұԵҳհף
<html>
<body>
<iframe src="frame_a.htm" id="frame1" marginwidth="50"></iframe>
<br /><br />

<script type="text/javascript">
x=document.getElementById("frame1");
document.write("Left and right margins of the iframe are: ");
document.write(x.marginWidth);
</script>

</body>
</html>
TIY
 iframe ԵұԵҳհס500û򷵻 iframe                 ơơû򷵻 iframe ơ



÷
name Կû򷵻 iframe ơ
﷨
iframeObject.name=name
ʵ
ӿɷ iframe ƣ
<html>
<body>
<iframe src="frame_a.htm" id="frame1" name="iframe">
</iframe><br />

<script type="text/javascript">
x=document.getElementById("frame1");
document.write("The iframe's name is: ");
document.write(x.name);
</script>

</body>
</html>
TIY
 <iframe> ơ500û򷵻 iframe Ƿӵй      ййû򷵻 iframe Ƿӵй



÷
scrolling Կû򷵻 iframe Ƿӵйԣ
﷨
iframeObject.scrolling=auto|yes|no
ʵ
ӿӺɾ iframe Ĺ
<html>
<head>
<script type="text/javascript">
function addScrollbars()
  {
  document.getElementById("frame1").scrolling="yes";
  }
  function removeScrollbars()
  {
  document.getElementById("frame1").scrolling="no";
  }
</script>
</head>

<body>
<iframe src="frame_a.htm" id="frame1" ></iframe><br />

<input type="button" onclick="addScrollbars()"
value="Add Scrollbars" />
<input type="button" onclick="removeScrollbars()"
value="Remove Scrollbars" />

</body>
</html>
TIY
Ӻɾ <iframe> ԪصĹ500û򷵻ӦiframeеĵURL     URLURLû򷵻Ӧ iframe еĵ URL



÷
src Կû򷵻ر iframe еĵ URL
﷨
iframeObject.src=URL
ʵ
ӿɸܵԴ
<html>
<head>
<script type="text/javascript">
function changeSource()
  {
  document.getElementById("frame1").src="frame_c.htm"
  document.getElementById("frame2").src="frame_d.htm"
  }
</script>
</head>
<body>

<iframe src="frame_a.htm" id="frame1"></iframe>
<iframe src="frame_b.htm" id="frame2"></iframe>
<br /><br />
<input type="button" onclick="changeSource()"
value="Change source of the two iframes" />

</body>
</html>
TIY
ܵԴ500û򷵻 iframe Ŀ                ȫȫû򷵻 iframe Ŀȡ



÷
width Կû򷵻 iframe ĿȣػٷֱΪλ
﷨
iframeObject.width=pixels
ʵ
ӿɸ iframe Ŀȣ
<html>
<head>
<script type="text/javascript">
function changeWidth()
{
document.getElementById("frame1").width="100";
}
</script>
</head>
<body>

<iframe src="frame_a.htm" id="frame1" width="200"></iframe>
<br /><br />

<input type="button" onclick="changeWidth()"
value="Change size" />

</body>
</html>
TIY
 iframe ĸ߶ȺͿȡ345ͼͼImage 
Image Ƕͼ
<img> ǩÿһΣһ Image ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.513û򷵻ݵĶ뷽ʽ          û򷵻ݵĶ뷽ʽ



÷
align Կ÷ݵĶ뷽ʽ
﷨
imageObject.align=left|right|top|middle|bottom
ʵ
ӰͼΧıҶ룺
<html>
<body>

<img id="compman" src="compman.gif" alt="Computerman" />
	
<p>Some text. Some text. Some text. Some text.</p>
	
<script type="text/javascript">
document.getElementById("compman").align="right";
</script>

</body>
</html>
TIY
 <image> ԪصĶ뷽ʽ513û򷵻޷ʾͼʱı      ġġû򷵻޷ʾͼʱı


÷
alt Կû򷵻ͼ޷ʾʱı
﷨
imageObject.alt=alternate_text
ʵ
ӽͼı
<html>
<head>
<script type="text/javascript">
function changeAlt()
  {
  document.getElementById("compman").alt="Man using computer"
  }
function alertAlt()
  {
  alert(document.getElementById("compman").alt)
  }
</script>
</head>
<body>

<img id="compman" src="compman.gif" alt="Computerman" />
<br />
<input type="button" onclick="changeAlt()"
value="Change alt text">
<br /><br />
<input type="button" onclick="alertAlt()" 
value="Alert alt text">

</body>
</html>
TIY
ͼı513û򷵻ͼΧı߿                û򷵻ͼΧı߿


÷
border Կû򷵻ͼΧı߿ȡ
﷨
imageObject.border=pixels
ʵ
ӿɸͼı߿ȣ
<<html>
<head>
<script type="text/javascript">
function changeBorder()
  {
  document.getElementById("compman").border="3"
  }
</script>
</head>
<body>

<img id="compman" src="compman.gif" alt="Computerman" />
<br /><br />
<input type="button" onclick="changeBorder()"
value="Change border" />

</body>
</html>
TIY
ͼΧı߿513Ƿɶͼļ        ɡɡǷɶͼļء



÷
complete ԿɷǷɶͼļء
ɣ򷵻 true򷵻 fasle
﷨
imageObject.complete
ʵ
ӿɼͼǷɼأ
<html>
<head>
<script type="text/javascript">
function alertComplete()
{
alert(document.getElementById("compman").complete)
}
</script>
</head>
<body onload="alertComplete()">

<img id="compman" src="compman.gif" alt="Computerman"
width="107" height="98" />

</body>
</html>
TIY
ͼǷɼء513û򷵻ͼĸ߶                    ȫߡȫߡû򷵻ͼĸ߶ȡ




÷
height Կû򷵻ͼĸ߶ȡ
﷨
imageObject.height=pixels
ʵ
ӿͼĸ߶ȺͿȣ
<html>
<head>
<script type="text/javascript">
function changeSize()
{
document.getElementById("compman").height="250"
document.getElementById("compman").width="300"
}
</script>
</head>

<body>
<img id="compman" src="compman.gif" width="107" height="98" />
<br /><br />
<input type="button" onclick="changeSize()"
value="Change size of image">
</body>

</html>
TIY
ͼĸ߶ȺͿȡ513û򷵻ͼҲĿհ          ͼաͼաû򷵻ͼҲĿհס



÷
hspace Կû򷵻ͼԵұԵĿհס
hspace  vspace Կ align һͬʹãͼΧıľ롣
﷨
imageObject.hspace=pixels
ʵ
ӽͼ hspace  vspace ԣ
<html>
<head>
<script type="text/javascript">
function setSpace()
{
document.getElementById("compman").hspace="50"
document.getElementById("compman").vspace="50"
}
</script>
</head>
<body>

<img id="compman" src="compman.gif" alt="Computerman" align="right" />

<p>Some text. Some text. Some text. Some text.</p>

<input type="button" onclick="setSpace()"
value="Set hspace and vspace">

</body>
</html>
TIY
ͼˮƽʹֱλ513û򷵻ͼ id                     ididû򷵻ͼ id


÷
id Կû򷵻ͼ id
﷨
imageObject.id=id
ʵ
ӽַͨͼ id
<html>
<body>
<img id="compman" src="compman.gif" alt="Computerman" />
<br />

<script type="text/javascript">
x=document.getElementsByTagName('img')[0];
document.write("Image id: " + x.id);
document.write("<br />");
document.write("An alternate way: ");
document.write(document.getElementById('compman').id);
</script>

</body>
</html>
TIY
ȡͼ id513ͼǷǷ˵ͼӳ        ӳӳͼǷǷ˵ͼӳ䡣



÷
isMap ԷͼǷǷͼӳ䡣
﷨
imageObject.isMap
ʵ
ӿɼͼǷǷͼӳ䣺
<html>
<body>

<img id="planets" src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="The planet Venus"
href="venus.htm" />
</map>

<p>Is the image a server-side image map?
<script type="text/javascript">
x=document.getElementById('planets');
document.write(x.isMap);
</script>
</p>

</body>
</html>
TIY
ͼǷǷͼӳ
513û򷵻ָͼĵURL   URL˵URL˵û򷵻ָͼĵ URL



÷
longDescԿû򷵻ذͼĵ URL
Ƕ "alt" ԵĲ䣬ɶԷǿӵûá
﷨
imageObject.longDesc=URL
ʵ
ӽһָͼӣ
<html>
<body>
<img id="compman" src="compman.gif"
longdesc="compman_description.htm" alt="Computerman" />
<br />

<script type="text/javascript">
var x=document.getElementById("compman");
document.write("Description for image: ");
document.write('<a href="' + x.longDesc + '">Description</a>');
</script>

</body>
</html>
TIY
һϳͼӡ513û򷵻ָͼĵͷֱʰ汾URL   URLURLû򷵻ָͼĵͷֱʰ汾 URL



÷
lowsrc Կû򷵻ͼĵͷֱʰ汾 URL
﷨
imageObject.lowsrc=URL
ʵ
ӿɴһָͼĵͷֱʰ汾ӣ
<html>
<body>
<img id="compman" src="compman.gif"
lowsrc="compman_lowres.gif" alt="Computerman" />
<br />

<script type="text/javascript">
var x=document.getElementById("compman");
document.write('<a href="' + x.lowsrc + '">Low resolution</a>');
</script>

</body>
</html>
TIY
һָͼĵͷֱʰ汾ӡ513û򷵻ͼ                    ơơû򷵻ͼơ



÷
name Կû򷵻ͼơ
һ <img> һ name ԣͿ԰Ӧ Image Ϊ Document ʡ
﷨
imageObject.name=name
ʵ
ӿɷͼƣ
<html>
<body>
<img id="compman" name="compman" 
src="compman.gif" alt="Computerman" width="107" height="98" />
<br />

<script type="text/javascript">
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>

</body>
</html>
TIY
ȡͼơ513û򷵻ؿͻͼӳusemapԵֵͼͼû򷵻ؿͻͼӳ usemap Եֵ



÷
useMap Կû򷵻ͼ usemap Եֵ
﷨
imageObject.useMap=URL
ʵ
ӿͻͼӳ usemap Եֵ
<html>
<body>

<img id="planets" src="planets.gif" 
width="145" height="126" 
usemap="#planetmap" />

<map name="planetmap">
<area id="venus" shape="circle" 
coords="124,58,8" 
alt="The planet Venus"
href="venus.htm" />
</map>

<p>The value of the usemap attribute=
<script type="text/javascript">
x=document.getElementById('planets');
document.write(x.useMap);
</script>
</p>

</body>
</html>
TIY
ؿͻͼӳ usemap Եֵ513û򷵻ͼĶ͵ײĿհ        ͼաͼաû򷵻ͼĶ͵ײĿհס



÷
vspace û򷵻ͼĶ͵ײĿհס
Thspace  vspace Կ align һͬʹãͼΧıľ롣
﷨
imageObject.vspace=pixels
ʵ
ӽͼ hspace  vspace ԣ
<html>
<head>
<script type="text/javascript">
function setSpace()
{
document.getElementById("compman").hspace="50"
document.getElementById("compman").vspace="50"
}
</script>
</head>
<body>

<img id="compman" src="compman.gif" alt="Computerman" align="right" />

<p>Some text. Some text. Some text. Some text.</p>

<input type="button" onclick="setSpace()"
value="Set hspace and vspace">

</body>
</html>
TIY
ͼˮƽʹֱλ513û򷵻ͼĿ                    ȫȫû򷵻ͼĿȡ



÷
width Կû򷵻ͼĿȡ
﷨
imageObject.width=pixels
ʵ
ӿͼĸ߶ȺͿȣ
<html>
<head>
<script type="text/javascript">
function changeSize()
{
document.getElementById("compman").height="250"
document.getElementById("compman").width="300"
}
</script>
</head>

<body>
<img id="compman" src="compman.gif" width="107" height="98" />
<br /><br />
<input type="button" onclick="changeSize()"
value="Change size of image">
</body>

</html>
TIY
ͼĸ߶ȺͿȡ513û򷵻ͼ URL                    URLURLû򷵻ͼ URL



÷
src Կû򷵻ͼ URL
עͣԿʱ䱻ġͼ̳ԭʼͼ height  width ԡ
Եĳʼֵɱ <img>  src áѸΪͼ URL ʱͻǷͼװزʾڸҳͼӦûĶǳá
﷨
imageObject.src=URL
ʵ
<html>
<head>
<script type="text/javascript">
function changeSrc()
  {
  document.getElementById("myImage").src="hackanm.gif"
  }
</script>
</head>
<body>

<img id="myImage" src="compman.gif" width="107" height="98" />
<br /><br />
<input type="button" onclick="changeSrc()" value="Change image">

</body>
</html>
TIY
ͼ src513ûͼװʱõ  ¼ضϡضϡûͼװʱõ¼


÷
ûͼװʱõ¼
﷨
imageObject.onabort
˵
Image  onabort һ¼ûͼ֮ǰͼװأ絥 Stop ťʱͻ513װͼзʱ    ¼װͼĹзʱõ¼


÷
װͼĹзʱõ¼
﷨
imageObject.onerror
˵
Image  onerror һ¼װͼĹз˴ʱͻ513ͼװʱõ        ¼ͼװʱõ¼



÷
ͼװʱõ¼
﷨
imageObject.onload
˵
Image  onload һ¼ͼװϵʱͻ345ťťButton 
Button  HTML ĵеһť
ԪûĬϵΪǱһ onclick ¼Աʹá
 HTML ĵ <input type="button"> ǩÿһΣһ Button  ͻᱻ
ͨ elements[] ĳťͨʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.532û򷵻طʰťĿݼ              ݼݼû򷵻طʰťĿݼ



÷
accessKey Կû򷵻طһťļ̰
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
buttonObject.accessKey=accessKey
ʵ
ӿɷһťĿݼ
<html>
<body>

<form>
<input type="button" value="Click me!" 
accesskey="b" id="button1" />
</form>

<p>AccessKey for button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
һťĿݼ

532û򷵻޷ʾťʱı  ġġû򷵻ص޷ʾťʱʾı


÷
alt Կû򷵻صְ֧ťʱҪʾ滻ı
﷨
buttonObject.alt=alternate_text
ʵ
ӿɷذť alt ı
<html>
<body>

<form>
<input type="button" alt="Button" id="button1"
value="Click me" />
</form>

<p>The alt text for the button is:
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
ذť滻ı532û򷵻Ƿť                  ááû򷵻Ƿðť



÷
disabled Կû򷵻Ƿðť
﷨
buttonObject.disabled=true|false
ʵ
ӽðť
<html>
<head>
<script type="text/javascript">
function disableButton()
{
document.getElementById("myButton").disabled=true
}
</script>
</head>

<body>
<form>
<button id="myButton" onClick="disableButton()">
Click Me!</button>
</form>
</body>

</html>
TIY
ʾť id   + ðť532ض԰ðťı        ض԰ðťıá



÷
form Կɷض԰ðťıá
ðť򷵻һ form δðť򷵻 null
﷨
buttonObject.form
ʵ
ӿɷذťı id
<html>
<body>

<form id="form1">
<input type="button" value="Click me!" id="button1" />
</form>

<p>The id of the form containing the button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ذťı id532û򷵻ذť id                     ididû򷵻ذť id




÷
id Կû򷵻ذť id
﷨
buttonObject.id=id
ʵ
ӿɻȡť id
<html>
<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById("myButton").id)
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" id="myButton"
onclick="alertId()" />
</form>
</body>

</html>
TIY
ʾť idͺֵ + ðť532û򷵻ذť                    ơơû򷵻ذťơ



÷
name Կû򷵻ذťơ
﷨
buttonObject.name=name
ʵ
ӿɷذťƣ
<html>
<body>

<form>
<input type="button" id="button1"
name="button1" value="Click Me!" />
</form>

<p>The name of the button is: 
<script type="text/javascript">
x=document.getElementById('button1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ذťơ532û򷵻ذť tab ƴ         tabtabû򷵻ذť tab ƴ



÷
tabIndex Կû򷵻ذť tab ƴ
﷨
buttonObject.tabIndex=tabIndex
ʵ
ӽذť tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var b1=document.getElementById('b1').tabIndex;
  var b2=document.getElementById('b2').tabIndex;
  var b3=document.getElementById('b3').tabIndex;
  document.write("Tab index of Button 1: " + b1);
  document.write("<br />");
  document.write("Tab index of Button 2: " + b2);
  document.write("<br />");
  document.write("Tab index of Button 3: " + b3);
  }
</script>
</head>
<body>

<form>
<input type="button" id="b1" tabIndex="1" value="Button 1" />
<br />
<input type="button" id="b2" tabIndex="2" value="Button 2" />
<br />
<input type="button" id="b3" tabIndex="3" value="Button 3" />
<br />
<input type="button" onclick="showTabIndex()"
value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾť tab ƴ532ذťıԪ                  ͡͡ذťıԪ͡



÷
type ԿɷرԪص͡Button ʼ "button"
﷨
buttonObject.type
ʵ
ӽذťıԪͣ
<html>
<head>
<script type="text/javascript">
function alertType()
{
alert(document.getElementById("myButton").type)
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" id="myButton"
onclick="alertType()" />
</form>
</body>

</html>
TIY
ʾť idͺֵ + ðť532û򷵻ڰťʾı            ֵֵû򷵻ڰťʾı



÷
value Կû򷵻ʾڰťϵı
﷨
buttonObject.value=sometext
ʵ
<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("myButton").value)
}
</script>
</head>

<body>
<form>
<input type="button" value="Click me!" id="myButton"
onclick="alertValue()" />
</form>
</body>

</html>
TIY
ʾť idͺֵ + ðť532ѽԪƿ()                    ƽƽѽԪƿ



÷
blur() ڰѽӰťƿ
﷨
buttonObject.blur()
ʵ
ӽɽӰťƿ
<html>
<head>
<script type="text/javascript">
function removeFocus()
  {
  document.getElementById('button1').blur()
  }
</script>
</head>
<body>

<form>
<input type="button" id="button1" value="Button1" />
<br />
<input type="button" onclick="removeFocus()"
value="Remove focus from Button 1" />
</form>

</body>
</html>
TIY
òӰťƿ532ĳťģһ굥()          ĳťģһ굥



÷
click() ģڰťϵһ굥
﷨
buttonObject.click()
ʵ
ӽ body onload ģڰťϵһ굥
<html>
<head>
<script type="text/javascript">
function clickButton()
  {
  document.getElementById('button1').click()
  }
function alertMsg()
  {
  alert("Button 1 was clicked!")
  }
</script>
</head>
<body onload="clickButton()">

<form>
<input type="button" id="button1" onclick="alertMsg()"
value="Button 1" />
</form>

</body>
</html>
TIY
ģڰťϵһ굥532Ϊĳť轹()                    Ϊĳť轹㡣




÷
focus() ť轹㡣
﷨
buttonObject.focus()
ʵ
ӽڰťý㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('button1').focus()
  }
</script>
</head>
<body>

<form>
<input type="button" id="button1" value="Button1" />
<br />
<input type="button" onclick="setFocus()"
value="Set focus to Button 1" />
</form>

</body>
</html>
TIY
òӰťƿ345ѡѡCheckbox 
Checkbox һ HTML е һѡ
 HTML ĵ <input type="checkbox"> ÿһΣCheckbox ͻᱻ
ͨ elements[] ĳѡ򣬻ͨʹ document.getElementById() 
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.545û򷵻ط checkbox Ŀݼ        ݼݼû򷵻ط checkbox Ŀݼ



÷
accessKey û򷵻 checkbox Ŀݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
checkboxObject.accessKey=accessKey
ʵ
ӷ checkbox Ŀݼ
<html>
<body>

<form>
<input type="checkbox" accesskey="c" id="check1" />
</from>

<p>AccessKey for checkbox is: 
<script type="text/javascript">
x=document.getElementById('check1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
 checkbox Ŀݼ545û򷵻ز֧checkboxʱı      ġġû򷵻ز֧ checkbox ʱʾı



÷
alt Կû򷵻֧ checkbox ʱʾı
﷨
checkboxObject.alt=alternate_text
ʵ
ӷ checkbox ı
<html>
<body>

<form>
I have a bike: <input id="bike" alt="bike" type="checkbox" name="Bike" />
<br />
I have a car: <input id="car" alt="car" type="checkbox" name="Car" />
</form>

<p>The alt text for the checkboxes are:
<script type="text/javascript">
document.write(document.getElementById('bike').alt);
document.write(" and ");
document.write(document.getElementById('car').alt);
</script></p>

</body>
</html>
TIY
 checkbox  alt ı545û򷵻 checkbox ǷӦѡ        ѡСѡСû򷵻 checkbox ǷӦѡС



÷
checked û򷵻 checkbox ǷӦѡС
﷨
checkboxObject.checked=true|false
˵
Ա checkbox ĵǰ״̬ܺʱֵ仯ʱonclick ¼ͻᴥҲܴ onchange ¼
ʵ
ӿø checkbox ״̬
<html>
<head>
<script type="text/javascript">
function check()
  {
  document.getElementById("check1").checked=true
  }
function uncheck()
  {
  document.getElementById("check1").checked=false
  }
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" />
<input type="button" onclick="check()" value="Check Checkbox" />
<input type="button" onclick="uncheck()" value="Uncheck Checkbox" />
</form>

</body>
</html>
TIY
ѡԼѡ checkbox
һеɸ checkbox
Checkbox - ıתΪд545 checked ԵĬֵ               ĬϱѡСĬϱѡС checked ԵĬֵ



÷
defaultChecked Կɷ checked ԵĬֵ
 checkbox Ĭϱѡʱ true򷵻 false
﷨
checkboxObject.defaultChecked
ʵ
ӿɷ checked Եֵ
<html>
<body>

<form>
<input type="checkbox" id="myCheck" checked="checked" />
</form>

<script type="text/javascript">
alert(document.getElementById("myCheck").defaultChecked)
</script>

</body>
</html>
TIY
 checkbox ǷĬϱѡ
ѡԼѡ checkbox545û򷵻 checkbox ǷӦ        ááû򷵻 checkbox ǷӦá



÷
disabled Կû򷵻Ƿ checkbox
﷨
checkboxObject.disabled=true|false
ʵ
ӽ˸ checkbox
<html>
<head>
<script type="text/javascript">
function disable()
  {
  document.getElementById("check1").disabled=true
  }
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" />
<input type="button" onclick="disable()" value="Disable Checkbox" />
</form>

</body>
</html>
TIY
 checkbox545ض԰ checkbox ı        ض԰ checkbox ıá



÷
form Էض԰Ԫصıá
﷨
checkboxObject.form
ʵ
ӷ˸ checkbox ı id
<html>
<body>

<form id="form1">
<input type="checkbox" id="check1" />
</form>

<p>The form containing the checkbox is: 
<script type="text/javascript">
x=document.getElementById('check1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡ checkbox ı id545û򷵻 checkbox  id               ididû򷵻 checkbox  id



÷
id Կû򷵻 checkbox  id
﷨
checkboxObject.id=id
ʵ
ӿ checkbox  id
<html>
<body>

<form>
<input type="checkbox" id="check1" />
</form>

<p>The id of the checkbox is:
<script type="text/javascript">
document.write(document.getElementById("check1").id)
</script>
</p>

</body>
</html>
TIY
ȡ checkbox  id545û򷵻 checkbox               ơơû򷵻 checkbox ơ



÷
name Կû򷵻 checkbox ơ
﷨
checkboxObject.name=name
ʵ
ӿ checkbox ƣ
<html>
<body>

<form>
<input type="checkbox" id="check1" name="check1" />
</form>

<p>The name of the checkbox is:
<script type="text/javascript">
document.write(document.getElementById("check1").name)
</script>
</p>

</body>
</html>
TIY
ȡ checkbox ơ545û򷵻checkbox tabƴ      tabtabû򷵻 checkbox  tab ƴ



÷
tabIndex Կû򷵻 checkbox  tab ƴ
﷨
checkboxObject.tabIndex=number
ʵ
ӿɸ checkbox  tab index
<html>
<head>
<script type="text/javascript">
function changeTabIndex()
{
document.getElementById('check3').tabIndex="1"
document.getElementById('check1').tabIndex="3"
}
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" tabIndex="1" /><br />
<input type="checkbox" id="check2" tabIndex="2" /><br />
<input type="checkbox" id="check3" tabIndex="3" /><br />

<input type="button" onclick="changeTabIndex()" value="Change tabIndex" />
</form>

</body>
</html>
TIY
 checkbox  tab 545 checkbox ıԪ            ͡͡ checkbox ıԪ͡



÷
type ԿɷԪصı͡һ checkbox 󣬸Ƿ "checkbox"
﷨
checkboxObject.type
ʵ
ӷ checkbox ıԪͣ
<html>
<body>

<form>
<input type="checkbox" id="check1" />
</form>

<script type="text/javascript">
x=document.getElementById("check1");
document.write("Form element type is: ");
document.write(x.type);
</script>

</body>
</html>
TIY
 checkbox ıԪ͡545û򷵻 checkbox  value Եֵ   ֵֵû򷵻 checkbox  value Եֵ



545 checkbox ƿ()                ƽƽ checkbox ƿ㡣



÷
blur() ڴ checkbox ƿ㡣
﷨
checkboxObject.blur()
ʵ
ӿòƿ checkbox ϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('check1').focus()
  }
function loseFocus()
  {
  document.getElementById('check1').blur()
  }
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" />
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
òƿ checkbox ϵĽ545ģ checkbox еһ()      ģ checkbox еһ



÷
click()  checkbox ģһ굥
﷨
checkboxObject.click()
ʵ
ӿ checkbox ģһ
<html>
<head>
<script type="text/javascript">
function clickCheckbox()
  {
  document.getElementById('check1').click()
  }
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" />
<br />
<input type="button" onclick="clickCheckbox()" value="Click checkbox" />
</form>

</body>
</html>
TIY
 checkbox ģһ545Ϊ checkbox 轹()                  Ϊ checkbox 轹㡣



÷
focus() Ϊ checkbox 轹㡣
﷨
checkboxObject.focus()
ʵ
ûƿ checkbox ϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('check1').focus()
  }
function loseFocus()
  {
  document.getElementById('check1').blur()
  }
</script>
</head>
<body>

<form>
<input type="checkbox" id="check1" />
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
òƿ checkbox ϵĽ345ļļFileUpload 
 HTML ĵ <input type="file"> ǩÿһΣһ FileUpload ͻᱻ
ԪذһıֶΣļһťļѡԻԱͼλѡļ
Ԫص value Աûָļƣǵһ file-upload ԪصıύʱѡеļݶǷļ
Ϊȫfile-upload Ԫز HTML ߻ JavaScript ԱָһĬϵļHTML value ԱԣҶڴԪ˵value ֻģζֻûһļûѡ༭һļfile-upload Ԫش onchange ¼
ͨ elements[] 飬ͨʹ document.getElementById() FileUpload 
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.560û򷵻ļMIME͵б        ббû򷵻ָʾļ MIME ͵бŷָ560û򷵻طFileUploadݼ      ݼݼû򷵻ط FileUpload Ŀݼ560û򷵻ز֧ʱ              ġġû򷵻ز֧ <input type="file"> ʱʾ֡560û򷵻FileUploadĳʼֵ        ʼֵʼֵû򷵻 FileUpload ĳʼֵ560û򷵻ǷFileUpload        ááû򷵻Ƿ FileUpload 󡣡560ض԰FileUpload        ض԰ FileUpload ıá560û򷵻 FileUpload  id         ididû򷵻 FileUpload  id560û򷵻 FileUpload         ơơû򷵻 FileUpload ơ560û򷵻ضtabƴ     tabtabû򷵻ض FileUpload  tab ƴš560رԪص                      ͡͡رԪص͡ FileUpload "file" 560ûõıļ        ֵֵûõıFileUpload ļ560FileUploadƿ()            ƽƽ FileUpload ƿ㡣560Ϊ FileUpload 轹()            Ϊ FileUpload 轹㡣560ѡȡ FileUpload ()                  ѡȡѡȡѡȡ FileUpload 󡣡345Hidden 
Hidden һ HTML еĳ
͵ԪʵصġɼıԪص value ԱһҪύ Web ַҪύûֱݵĻ͵Ԫء
 HTML  <input type="hidden"> ǩÿһΣһ Hidden ͻᱻ
ͨ elements[] ĳ򣬻ͨʹdocument.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.575û򷵻ز֧ʱʾı    ġġû򷵻ص֧ʱʾı



÷
alt Կû򷵻֧ʱʾı
﷨
hiddenObject.alt=alternate_text
ʵ
ӷ alt ı
<html>
<body>

<form>
<input type="hidden" alt="Hidden field" id="hidden1" />
</form>

<p>The alt text for the hidden field is:
<script type="text/javascript">
x=document.getElementById('hidden1');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
 alt ı575һ԰ı        һ԰ıá



÷
form Կɷض԰ıá
﷨
hiddenObject.form
ʵ
ӷ˸ı id
<html>
<body>

<form id="form1">
<input type="hidden" id="hidden1" />
</form>

<p>The id of the form containing the hidden element is: 
<script type="text/javascript">
x=document.getElementById('hidden1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡı id575û򷵻 id                   ididû򷵻 id



÷
id Կû򷵻 id
﷨
hiddenObject.id=id
ʵ
ӿȡ id
<html>
<body>

<form>
<input type="hidden" id="hidden1" />
</form>

<p>The id of the hidden field is: 
<script type="text/javascript">
x=document.getElementById('hidden1');
document.write(x.id);
</script></p>

</body>
</html>
TIY
ȡ id575û򷵻                  ơơû򷵻ơ



÷
name Կû򷵻ơ
﷨
hiddenObject.name=name
ʵ
ӿɷƣ
<html>
<body>

<form>
<input type="hidden" id="hidden1" name="hidden1" />
</form>

<p>The name of the hidden field is:
<script type="text/javascript">
alert(document.getElementById("hidden1").name)
</script></p>

</body>
</html>
TIY
ȡơ575ı                ͡͡ı͡




÷
type ԿɷرԪص͡ hidden 󣬸 "hidden"
﷨
hiddenObject.type
ʵ
ӷ˸ıԪͣ
<html>
<body>

<form>
<input type="hidden" id="hidden1" />
</form>

<script type="text/javascript">
x=document.getElementById("hidden1");
document.write("Form element type is: ");
document.write(x.type);
</script>

</body>
</html>
TIY
ȡıԪ͡575û򷵻valueԵֵ         ֵֵû򷵻 value Եֵ



÷
value Կû򷵻 value Եֵ
value Զ˸Ĭֵ
﷨
hiddenObject.value
ʵ
ӿȡøֵ
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  alert(document.getElementById("hidden1").value)
  }
</script>
</head>
<body>

<form>
<input type="hidden" id="hidden1" value="W3School" />
<input type="button" id="button1" onclick="alertValue()" 
value="Show value of the hidden field" />
</form>

</body>
</html>
TIY
ȡֵ345Password 
Password  HTML еֶΡ
HTML  <input type="password"> ǩڱÿһΣһ Password ͻᱻ
ıֶιûĳЩеݣȡûʱǱڸǵģʹǺ*ԷֹԱߵ˴󿴵ݡҪעǣύʱķ͵ġ
Ϊ "text" Ԫƣûıʾֵʱᴥ onchange ¼
ͨ elements[] array ֶΣͨʹ document.getElementById() 
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.582û򷵻طֶεĿݼ          ݼݼû򷵻طֶεĿݼ



÷
accessKey Կû򷵻طĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
passwordObject.accessKey=accessKey
ʵ
ӷĿݼ
<html>
<body>

<form>
<input type="password" accesskey="p" id="password1" />
</form>

<p>AccessKey for password field is: 
<script type="text/javascript">
x=document.getElementById('password1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
طĿݼ582û򷵻صֶ֧ʱʾ  ġġû򷵻صֶ֧ʱʾ֡


÷
alt û򷵻֧ʱʾı
﷨
passwordObject.alt=alternate_text
ʵ
ӿɷı
<html>
<body>

<form>
<input type="password" alt="Password field" id="pwd1" />
</form>

<p>The alt text for the password field is:
<script type="text/javascript">
x=document.getElementById('pwd1');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
 alt ı582û򷵻ֶεĬֵ              ʼֵʼֵû򷵻ֶεĬֵ




÷
defaultValue Կû򷵻Ĭֵ
עͣĬֵ HTML "value" й涨Ĭֵ
﷨
passwordObject.defaultValue=somevalue
ʵ
ӿɻĬֵ
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  alert(document.getElementById("password1").defaultValue)
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" id="button1" onclick="alertValue()" 
value="Show default value" />
</form>

</body>
</html>
TIY
Ĭֵ582û򷵻ǷӦֶ          ááû򷵻ǷӦֶΡ


÷
disabled Կû򷵻Ƿ
﷨
passwordObject.disabled=true|false
ʵ
ӽ˸
<html>
<head>
<script type="text/javascript">
function disablePassword()
  {
  document.getElementById("password1").disabled=true
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" />
<input type="button" id="button1" onClick="disablePassword()" 
value="Disable password field" />
</form>

</body>
</html>
TIY
һ582ض԰ֶεı        ض԰ֶεıá




÷
form Կɷض԰ıá
ɹԽһ
﷨
passwordObject.form
ʵ
ȡ˸ı id
<html>
<body>

<form id="form1">
<input type="password" id="password1" />
</form>

<p>The id of the form containing the password field is:
<script type="text/javascript">
x=document.getElementById('password1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡı id582û򷵻ֶε id                 ididû򷵻ֶε id



÷
id û򷵻 id
﷨
passwordObject.id=id
ʵ
ӷ˸ id
<html>
<body>

<form id="form1">
<input type="password" id="password1" />
</form>

<p>The id of the password field is:
<script type="text/javascript">
x=document.getElementById('password1');
document.write(x.id);
</script></p>

</body>
</html>
TIY
ȡ id582û򷵻ֶַĿ      û򷵻ֶַĿ



÷
maxLength Կû򷵻ַ
﷨
passwordObject.maxLength=number_of_chars
ʵ
ӿʾַָ
<html>
<head>
<script type="text/javascript">
function alertLength()
  {
  alert(document.getElementById("password1").maxLength)
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" maxLength="8" />
<input type="button" id="button1" onclick="alertLength()"
value="Alert maxLength" />
</form>

</body>
</html>
TIY
ַ582û򷵻ֶε                ơơû򷵻ֶεơ



÷
name Կû򷵻ơ
﷨
passwordObject.name=name
ʵ
ӿɻƣ
<html>
<body>

<form id="form1">
<input type="password" id="password1" name="password1" />
</form>

<p>The name of the password field is:
<script type="text/javascript">
x=document.getElementById('password1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ơ582û򷵻ֶǷӦֻ      ֻֻû򷵻ֶǷӦֻġ



÷
readOnly Կû򷵻ǷΪֻ
﷨
passwordObject.readOnly=true|false
ʵ
ӰΪֻ
<html>
<head>
<script type="text/javascript">
function makeReadOnly()
  {
  document.getElementById("password1").readOnly=true
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" onclick="makeReadOnly()" 
value="Make read-only" />
</form>

</body>
</html>
TIY
Ϊֻ582û򷵻ֶεĳ                ߴߴû򷵻ֶεĳȡ


÷
size Կû򷵻ĴСַƣ
﷨
passwordObject.size=number_of_chars
ʵ
ӸĴС
<html>
<head>
<script type="text/javascript">
function changeSize()
  {
  document.getElementById("password1").size=40
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" />
<input type="button" id="button1" onclick="changeSize()"
value="Change size of the password field" />
</form>

</body>
</html>
TIY
ĳߴ582û򷵻ֶεtabƴ       tabtabû򷵻ֶε tab ƴ



÷
tabIndex û򷵻 tab ƴ
﷨
passwordObject.tabIndex=number
ʵ
ӿʾԪص tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var email=document.getElementById('email').tabIndex;
  var pwd=document.getElementById('pwd').tabIndex;
  document.write("Tab index of email field: " + email);
  document.write("<br />");
  document.write("Tab index of password field: " + pwd);
  }
</script>
</head>
<body>

<form>
Email: <input type="text" id="email" tabindex="1" />
<br />
Password: <input type="password" id="pwd" tabindex="2" />
<br />
<input type="button" onclick="showTabIndex()" value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾԪص tab ƴ582ֶεıԪ              ֶ͡͡εıԪ͡



÷
type ԿñԪص͡򣬸 "password"
﷨
passwordObject.type
ʵ
ӷ˸ıԪͣ
<html>
<body>

<form>
<input type="password" id="password1" />
</form>

<script type="text/javascript">
x=document.getElementById("password1");
document.write("Form element type is: ");
document.write(x.type);
</script>

</body>
</html>
TIY
ȡıԪ͡582û򷵻ֶεvalueԵֵ       ֵֵû򷵻ֶε value Եֵ


÷
value Կû򷵻Ĭֵ
ڰȫǣһЩֹ JavaScript ȡ value ԡ
﷨
passwordObject.value=text
ʵ
ӿɻĬֵ
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  alert(document.getElementById("password1").value)
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" id="button1" onclick="alertValue()" 
value="Show default value" />
</form>

</body>
</html>
TIY
Ĭֵ582ֶƿ()                    ƽƽֶƿ㡣



÷
blur() ڴƿ㡣
﷨
passwordObject.blur()
ʵ
ӿû򷵻Ľ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('password1').focus()
  }
function loseFocus()
  {
  document.getElementById('password1').blur()
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
û򷵻Ľ582Ϊֶθ轹()                    Ϊֶθ轹㡣



÷
focus() ý㡣
﷨
passwordObject.focus()
ʵ
ӿûƿϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('password1').focus()
  }
function loseFocus()
  {
  document.getElementById('password1').blur()
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
ûƿϵĽ582ѡȡֶеı()                  ѡȡѡȡѡȡֶеı


÷
select() ѡȡеı
﷨
passwordObject.select()
ʵ
ӿѡȡеı
<html>
<head>
<script type="text/javascript">
function selText()
  {
  document.getElementById('password1').select()
  }
</script>
</head>
<body>

<form>
<input type="password" id="password1" value="thgrt456" />
<input type="button" onclick="selText()" value="Select text" />
</form>

</body>
</html>
TIY
ѡȡеı345ѡѡRadio 
Radio  HTML еĵѡť
 HTML  <input type="radio"> ÿһΣһ Radio ͻᱻ
ѡťǱʾһ黥ѡťеһһťѡУ֮ǰѡеİťͱΪѡеġ
ѡťѡлѡʱðťͻᴥ onclick ¼
ͨ elements[]  Radio 󣬻ͨʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.599û򷵻طʵѡťĿݼ          ݼݼû򷵻طʵѡťĿݼ



÷
accessKey Կû򷵻طʵѡťĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
radioObject.accessKey=accesskey
ʵ
ӿɷصѡťĿݼ
<html>
<body>

<form>
Male: <input id="male" accesskey="m" type="radio"
name="Sex" value="Male" />
<br />
Female: <input id="female" accesskey="f" type="radio"
name="Sex" value="Female" />
</form>

<p>The access key for the radio buttons are:
<script type="text/javascript">
document.write(document.getElementById('male').accessKey);
document.write(" and ");
document.write(document.getElementById('female').accessKey);
</script></p>

</body>
</html>
TIY
صѡťĿݼ599û򷵻زֵ֧ѡťʱı    ġġû򷵻ڲֵ֧ѡťʱʾı



÷
alt Կû򷵻ֵ֧ѡťʱʾı
﷨
radioObject.alt=alternate_text
ʵ
ӿɷصѡť alt ı
<html>
<body>

<form>
Male: <input id="male" alt="male" type="radio"
name="Sex" value="Male" />
<br />
Female: <input id="female" alt="female" type="radio"
name="Sex" value="Female" />
</form>

<p>The alt text for the radio buttons are:
<script type="text/javascript">
document.write(document.getElementById('male').alt);
document.write(" and ");
document.write(document.getElementById('female').alt);
</script></p>

</body>
</html>
TIY
صѡť alt ı599û򷵻صѡť״̬                ѡСѡСû򷵻صѡť״̬



÷
checked Կû򷵻ĳѡťǷѡС
﷨
radioObject.checked=true|false
ʵ
ӿɶһѡťѡͲѡ
<html>
<head>
<script type="text/javascript">
function check()
  {
  document.getElementById("radio1").checked=true
  }
function uncheck()
  {
  document.getElementById("radio1").checked=false
  }
</script>
</head>
<body>

<form>
<input type="radio" id="radio1" />
<input type="button" onclick="check()" value="Check" />
<input type="button" onclick="uncheck()" value="Uncheck" />
</form>

</body>
</html>
TIY
ѡѡѡť599صѡťĬ״̬                  ĬϱѡСĬϱѡСصѡťĬ״̬



÷
defaultChecked Կɷ checked ԵĬֵ
ѡťĬ״̬ѡУ򷵻 true򷵻 fasle
﷨
radioObject.defaultChecked
ʵ
ӷ checked ԵĬֵ
<html>
<body>

<form>
<input type="radio" id="radio1" checked="checked" />
</form>

<script type="text/javascript">
alert(document.getElementById("radio1").defaultChecked);
</script>

</body>
</html>
TIY
صѡťĬ״̬599û򷵻Ƿõѡť              ááû򷵻Ƿõѡť



÷
disabled Կû򷵻Ƿõѡť
﷨
radioObject.disabled=true|false
ʵ
ӽ˸õѡť
<html>
<head>
<script type="text/javascript">
function disable()
  {
  document.getElementById("gnome").disabled=true
  }
</script>
</head>
<body>

<form>
Human: <input id="human" type="radio" name="creature" value="Human" />
<br />
Animal: <input id="animal" type="radio" name="creature" value="Animal" />
<br />
Gnome: <input id="gnome" type="radio" name="creature" value="Gnome" />
<br /><br />
<input type="button" onclick="disable()" value="Disable choice" />
</form>

</body>
</html>
TIY
ĳѡť599һ԰˵ѡťı    һ԰˵ѡťıá




÷
form Կɷض԰ðťıá
ɹԷһ
﷨
radioObject.form
ʵ
ӽظõѡťı id
<html>
<body>

<form id="form1">
<input type="radio" id="radio1" />
</form>

<p>The id of the form containing the radio button is: 
<script type="text/javascript">
x=document.getElementById('radio1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡõѡťı id599û򷵻صѡť id                 ididû򷵻صѡť id



÷
id Կû򷵻صѡť id
﷨
radioObject.id=id
ʵ
ӿʾѡť id
<html>
<body>

<form>
<input type="radio" id="radio1" />
</form>

<p>The id of the radio button is: 
<script type="text/javascript">
x=document.getElementById('radio1');
document.write(x.id);
</script>
</p>

</body>
</html>
TIY
ʾһѡť idͺֵ599û򷵻صѡť                ơơû򷵻صѡťơ



÷
name Կû򷵻صѡťơ
﷨
radioObject.name=name
ʵ
ӿʾõѡťƣ
<html>
<body>

<form>
<input type="radio" id="radio1" name="radio1" />
</form>

<p>The name of the radio button is: 
<script type="text/javascript">
x=document.getElementById('radio1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ȡһѡťơ599û򷵻صѡť tab ƴ     tabtabû򷵻صѡť tab ƴ



÷
tabIndex Կû򷵻صѡť tab ƴ
﷨
radioObject.tabIndex=number
ʵ
ӿʾѡť tab index
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var r1=document.getElementById('radio1').tabIndex;
  var r2=document.getElementById('radio2').tabIndex;
  var r3=document.getElementById('radio3').tabIndex;
  document.write("Tab index of radio button 1: " + r1);
  document.write("<br />");
  document.write("Tab index of radio button 2: " + r2);
  document.write("<br />");
  document.write("Tab index of radio button 3: " + r3);
  }
</script>
</head>
<body>

<form>
<input type="radio" id="radio1" tabindex="1" /><br />
<input type="radio" id="radio2" tabindex="2" /><br />
<input type="radio" id="radio3" tabindex="3" /><br />
<input type="button" onclick="showTabIndex()" value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾѡť tab ƴ599صѡťı                  ͡͡صѡťı͡



÷
type ԿɷصѡťıԪ͡ڵѡť "radio"
﷨
radioObject.type
ʵ
ӿɷصѡťıԪͣ
<html>
<body>

<form>
<input type="radio" id="radio1" />
</form>

<script type="text/javascript">
x=document.getElementById("radio1");
document.write("Form element type is: ");
document.write(x.type);
</script>

</body>
</html>
TIY
ȡõѡťıԪ͡599û򷵻صѡť value Եֵ     ֵֵû򷵻صѡť value Եֵ



÷
value Կû򷵻صѡť value Եֵ
﷨
radioObject.value=sometext
ʵ
<html>
<head>
<script type="text/javascript">
function check(browser)
  {
  document.getElementById("answer").value=browser
  }
</script>
</head>

<body>
<p>What's your favorite browser:</p>
<form>
<input type="radio" name="browser" onclick="check(this.value)"
value="Internet Explorer" />Internet Explorer<br />
<input type="radio" name="browser" onclick="check(this.value)"
value="Firefox" />Firefox<br />
<input type="radio" name="browser" onclick="check(this.value)"
value="Netscape" />Netscape<br />
<input type="radio" name="browser" onclick="check(this.value)"
value="Opera" />Opera<br />
<br />
Your favorite browser is: <input type="text" id="answer" size="20" />
</form>
</body>

</html>
TIY
ʹõѡťе value ԡ599ӵѡťƿ()                    ƽƽӵѡťƿ㡣



÷
blur() ڴӵѡťƿ㡣
﷨
radioObject.blur()
ʵ
ӿûƿѡťϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('male').focus()
  }
function loseFocus()
  {
  document.getElementById('male').blur()
  }
</script>
</head>
<body>

<form>
Male: <input id="male" type="radio" name="Sex" value="Male" />
<br />
Female: <input id="female" type="radio" name="Sex" value="Female" />
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
ûƿѡťϵĽ599ڵѡťģһ()          ڵѡťģһ



÷
click() ڵѡťģһ
﷨
radioObject.click()
ʵ
ӿڵѡťģһ
<html>
<head>
<script type="text/javascript">
function clickRadio()
  {
  document.getElementById('radio1').click()
  }
</script>
</head>
<body>

<form>
<input type="radio" id="radio1" />
<br />
<input type="button" onclick="clickRadio()"
value="Click radio button" />
</form>

</body>
</html>
TIY
ڵѡťģһ599Ϊѡť轹()                    Ϊѡť轹㡣



÷
focus() ڸ赥ѡť㡣
﷨
radioObject.focus()
ʵ
ӿΪ "Male" ѡťý㣺
<html>
<body>

<form>
Male: <input id="male" type="radio" name="Sex" value="Male" />
<br />
Female: <input id="female" type="radio" name="Sex" value="Female" />
</form>

<script type="text/javascript">
document.getElementById('male').focus();
</script>

</body>
</html>
TIY
ѡťý345ááReset 
Reset  HTML еһðť
 HTML  <input type="reset"> ǩÿһΣһ Reset ͻᱻ
ðťıԪصֵΪǵĬֵĬֵ HTML value Ի JavaScript  defaultValue ָ
ðťñ֮ǰ onclick ͨ fasle ȡ
 Form.reset()   Form.onreset ¼
ͨ elements[] ĳðťͨʹdocument.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.614û򷵻طðťĿݼ          ݼݼû򷵻طðťĿݼ



÷
accessKey Կû򷵻طðťĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
resetObject.accessKey=accessKey
ʵ
ӿɷðťĿݼ
<html>
<body>

<form>
<input type="reset" accesskey="r" id="reset1" />
</form>

<p>AccessKey for the reset button is: 
<script type="text/javascript">
x=document.getElementById('reset1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
ðťĿݼ614û򷵻ز֧ðťʱʾı    ġġû򷵻ص֧ðťʱʾı



÷
alt Կû򷵻֧ðťʱʾı
﷨
resetObject.alt=alternate_text
ʵ
ӿɷðť alt ı
<html>
<body>

<form>
<input type="reset" alt="Reset button" id="reset1" />
</form>

<p>The alt text for the reset button is:
<script type="text/javascript">
x=document.getElementById('reset1');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
ðť alt ı614û򷵻ðťǷӦ          ááû򷵻ðťǷӦá



÷
disabled Կû򷵻Ƿðť
﷨
resetObject.disabled=true|false
ʵ
ӻڵðťʱã
<html>
<head>
<script type="text/javascript">
function disableButton()
  {
  document.getElementById("reset1").disabled=true
  }
</script>
</head>

<body>
<form>
<input type="reset" id="reset1" onclick="disableButton()" />
</form>
</body>

</html>
TIY
ʾðť idͺֵ + ðť614һ԰ðťıüһ԰ðťıá



÷
form Կɷض԰ðťıá
ɹԷһ
﷨
resetObject.form
ʵ
ӽظðťı id
<html>
<body>

<form id="form1">
<input type="reset" id="reset1" />
</form>

<p>The id of the form containing the reset button is: 
<script type="text/javascript">
x=document.getElementById('reset1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡðťı id614û򷵻ðť id                 ididû򷵻ðť id



÷
id Կû򷵻ðť id
﷨
resetObject.id=id
ʵ
ӿɻóðť id
<html>
<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById("reset1").id)
}
</script>
</head>

<body>
<form>
<input type="reset" id="reset1" onclick="alertId()" />
</form>
</body>

</html>
TIY
ʾðť idͺֵ + ðť614û򷵻ðť                ơơû򷵻ðťơ



÷
name Կû򷵻ðťơ
﷨
resetObject.name=name
ʵ
ӽðťƣ
<html>
<body>

<form>
<input type="reset" id="reset1" name="reset1" />
</form>

<p>The name of the reset button is:
<script type="text/javascript">
x=document.getElementById('reset1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ðťơ614û򷵻ðť tab ƴ     tabtabû򷵻ðť tab ƴ



÷
tabIndex Կû򷵻ðť tab ƴ
﷨
resetObject.tabIndex=tabIndex
ʵ
ӿʾԪص tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var email=document.getElementById('email').tabIndex;
  var r1=document.getElementById('reset1').tabIndex;
  document.write("Tab index of email: " + email);
  document.write("<br />");
  document.write("Tab index of reset button: " + r1);
  }
</script>
</head>
<body>

<form>
Email: <input type="text" id="email" tabindex="1"
size="25" value="someone@example.com" />
<br />
<input type="reset" id="reset1" tabindex="2" />
<br /><br />
<input type="button" onclick="showTabIndex()"
value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾԪص tab ƴ614ðťıԪ              ͡͡ðťıԪ͡



÷
type ԿɷðťıԪ͡ȷϰť "reset"
﷨
resetObject.type
ʵ
ӿɷðťıԪͣ
<html>
<head>
<script type="text/javascript">
function alertType()
{
alert(document.getElementById("reset1").type)
}
</script>
</head>

<body>
<form>
<input type="reset" id="reset1" onclick="alertType()" />
</form>
</body>

</html>
TIY
ʾðť idͺֵ + ðť614û򷵻ðťʾı          ֵֵû򷵻ðťʾı



÷
value Կû򷵻ʾðťϵı
﷨
resetObject.value=sometext
ʵ
ӿʾʾðťϵı
<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("reset1").value)
}
</script>
</head>

<body>
<form>
<input type="reset" value="Reset values" id="reset1"
onclick="alertValue()" />
</form>
</body>

</html>
TIY
ʾðť idͺֵ + ðť614ðťƿ()                  ƽƽðťƿ㡣614ðťģһ()          ðťģһ614Ϊðť轹()                    Ϊðť轹㡣345ύύSubmit 
Submit  HTML еһύť (submit button)
 HTML  <input type="submit"> ǩÿһΣһ Submit ͻᱻ
ڱύ֮ǰ onclick ¼һͨ fasle ȡύ
 Form.submit()   Form.onsubmit ¼
ʵ֤
ͨ elements[] ĳύťͨʹdocument.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.627û򷵻طύťĿݼ          ݼݼû򷵻طύťĿݼ


÷
accessKey Կû򷵻طȷϰťĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
submitObject.accessKey=accessKey
ʵ
ӿɷȷϰťĿݼ
<html>
<body>

<form>
<input type="submit" accesskey="s" id="submit1" />
</form>

<p>AccessKey for the submit button is: 
<script type="text/javascript">
x=document.getElementById('submit1');
document.write(x.accessKey);
</script></p>

</body>
</html>
TIY
ȷϰťĿݼ627û򷵻ز֧ύťʱı      ġġû򷵻ص֧ύťʱʾı



÷
alt Կû򷵻֧ȷϰťʱʾı
﷨
submitObject.alt=alternate_text
ʵ
ӿɷȷϰť alt ı
<html>
<body>

<form>
<input type="submit" alt="submit button" id="submit1" />
</form>

<p>The alt text for the submit button is:
<script type="text/javascript">
x=document.getElementById('submit1');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
ȷϰť alt ı627û򷵻ύťǷӦ          ááû򷵻ύťǷӦá



÷
disabled Կû򷵻Ƿȷϰť
﷨
submitObject.disabled=true|false
ʵ
ӻڵȷϰťʱã
<html>
<head>
<script type="text/javascript">
function disableButton()
  {
  document.getElementById("submit1").disabled=true
  }
</script>
</head>

<body>
<form>
<input type="submit" id="submit1" onclick="disableButton()" />
</form>
</body>

</html>
TIY
ʾȷϰť idͺֵ + ðť627һ԰ύťı    һ԰ύťıá


÷
form Կɷض԰ȷϰťıá
ɹԷһ
﷨
submitObject.form
ʵ
ӽظȷϰťı id
<html>
<body>

<form id="form1">
<input type="submit" id="submit1" />
</form>

<p>The id of the form containing the submit button is: 
<script type="text/javascript">
x=document.getElementById('submit1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ȡȷϰťı id627û򷵻ύť id                 ididû򷵻ύť id




÷
id Կû򷵻ȷϰť id
﷨
submitObject.id=id
ʵ
ӿʾȷϰť id
<html>
<head>
<script type="text/javascript">
function alertId()
{
alert(document.getElementById("submit1").id)
}
</script>
</head>

<body>
<form>
<input type="submit" id="submit1" onclick="alertId()" />
</form>
</body>

</html>
TIY
ʾȷϰť idͺֵ + ðť627û򷵻ύť                ơơû򷵻ύťơ



÷
name Կû򷵻ȷϰťơ
﷨
submitObject.name=name
ʵ
ӿʾȷϰťƣ
<html>
<body>

<form>
<input type="submit" id="submit1" name="submit1" />
</form>

<p>The name of the submit button is:
<script type="text/javascript">
x=document.getElementById('submit1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ȡһȷϰťơ627û򷵻ύť tab ƴ     tabtabû򷵻ύť tab ƴ



÷
tabIndex Կû򷵻ȷϰť tab ƴ
﷨
submitObject.tabIndex=tabIndex
ʵ
ӿʾԪص tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var email=document.getElementById('email').tabIndex;
  var r1=document.getElementById('submit1').tabIndex;
  document.write("Tab index of email: " + email);
  document.write("<br />");
  document.write("Tab index of submit button: " + r1);
  }
</script>
</head>
<body>

<form>
Email: <input type="text" id="email" tabIndex="1"
size="25" value="someone@example.com" />
<br />
<input type="submit" id="submit1" tabIndex="2" />
<br /><br />
<input type="button" onclick="showTabIndex()" value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾԪص tab ƴ627ύťıԪ              ͡͡ύťıԪ͡



÷
type ԿɷȷϰťıԪ͡ȷϰť "submit"
﷨
submitObject.type
ʵ
ӿɷȷϰťıԪͣ
<html>
<head>
<script type="text/javascript">
function alertType()
{
alert(document.getElementById("submit1").type)
}
</script>
</head>

<body>
<form>
<input type="submit" id="submit1" onclick="alertType()" />
</form>
</body>

</html>
TIY
ʾȷϰť idͺֵ + ðť627û򷵻ύťʾı        ֵֵû򷵻ύťʾı



÷
value Կû򷵻ʾȷϰťϵı
﷨
submitObject.value=sometext
ʵ
ӿʾʾȷϰťϵı
<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("submit1").value)
}
</script>
</head>

<body>
<form>
<input type="submit" value="submit values" id="submit1"
onclick="alertValue()" />
</form>
</body>

</html>
TIY
ʾȷϰť idͺֵ + ðť627ύťƿ()                  ƽƽύťƿ㡣627ύťģһ()          ύťģһ627Ϊύť轹()                    Ϊύť轹㡣345ııText 
Text  HTML еı
 HTML  <input type="text"> ÿһΣText ͻᱻ
ԪؿɴһеıֶΡû༭ʾı뽹תƵԪصʱ򣬻ᴥ onchange ¼
ʹ HTML <textarea> ı롣 Textarea 
ı룬 <input type="text"> е type Ϊ "password" Input Password
ͨ elements[] ı򣬻ͨʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.640û򷵻طıĿݼ            ݼݼû򷵻طıĿݼ


÷
accessKey Կû򷵻طıĿݼ
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
textObject.accessKey=accessKey
ʵ
ıĿݼ
<html>
<head>
<script type="text/javascript">
function setAccessKeys()
  {
  document.getElementById('fname').accessKey="n"
  document.getElementById('pwd').accessKey="p"
  }
</script>
</head>

<body onload="setAccessKeys()">
<form>
Name: <input id="fname" type="text" />
<br />
Password: <input id="pwd" type="password" />
</form>
</body>

</html>
TIY
Ϊıӿݼ
Ϊɱӿݼ640û򷵻ز֧ıʱı        ġġû򷵻ص֧ıʱʾı



÷
alt Կû򷵻֧ıʱʾı
﷨
textObject.alt=alternate_text
ʵ
ӿɷı alt ı
<html>
<body>

<form>
Email: <input type="text" alt="Email input field" id="email" />
</form>

<p>The alt text for the text field is:
<script type="text/javascript">
x=document.getElementById('email');
document.write(x.alt);
</script></p>

</body>
</html>
TIY
ı alt ı640û򷵻ıĬֵ                ʼֵʼֵû򷵻ıĬֵ


÷
defaultValue Կû򷵻ıĬֵ
עͣĬֵǹ涨 HTML "value" Եֵ
﷨
textObject.defaultValue=somevalue
ʵ
ӿɻøıĬı
<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("text1").defaultValue)
}
</script>
</head>
<body>

<form>
<input type="text" id="text1" value="Hello World!" />
<input type="button" id="button1" onclick="alertValue()" 
value="Show default value" />
</form>

</body>
</html>
TIY
øıĬı640û򷵻ıǷӦ            ááû򷵻ıǷӦá



÷
disabled Կû򷵻Ƿı
﷨
textObject.disabled=true|false
ʵ
ӽһı
<html>
<head>
<script type="text/javascript">
function disableField()
  {
  document.getElementById("text1").disabled=true
  }
</script>
</head>
<body>

<form>
<input type="text" id="text1" value="Hello world!" />
<input type="button" id="button1" onclick="disableField()"
value="Disable text field" />
</form>

</body>
</html>
TIY
ı640һ԰ıı    һ԰ııá



÷
form ԿɷضӰııá
ɹԷһ
﷨
textObject.form
ʵ
Ϊıı id
<html>
<body>

<form id="form1">
<input type="text" id="text1" />
</form>

<p>The id of the form containing the text field is:
<script type="text/javascript">
x=document.getElementById('text1');
document.write(x.form.id);
</script></p>

</body>
</html>
TIY
ıı id640û򷵻ı id                   ididû򷵻ı id



÷
id û򷵻ı id
﷨
textObject.id=id
ʵ
˸ı id
<html>
<body>

<form>
<input type="text" id="text1" />
</form>

<p>The id of the text field is:
<script type="text/javascript">
x=document.getElementById('text1');
document.write(x.id);
</script></p>

</body>
</html>
TIY
ı id640û򷵻ıеַ          û򷵻ıеַ



÷
maxLength Կû򷵻ıеַ
﷨
textObject.maxLength=number_of_char
ʵ
ʾıַ
<html>
<head>
<script type="text/javascript">
function maxLen()
  {
  alert(document.getElementById("name").maxLength)
  }
</script>
</head>

<body>
<form>
Name:
<input type="text" id="name" value="Mickey Mouse" size="20" maxlength="30" />
<br /><br />
<input type="button" onclick="maxLen()" value="Alert maxlength" />
</form>
</body>

</html>
TIY
ʾıĳߴַ
ﵽıַʱһ640û򷵻ı                  ơơû򷵻ıơ



÷
name û򷵻ıơ
﷨
textObject.name=name
ʵ
ӻıƣ
<html>
<body>

<form>
Email: <input type="text" id="email" name="email" />
</form>

<p>The name of the text field is:
<script type="text/javascript">
x=document.getElementById('text1');
document.write(x.name);
</script></p>

</body>
</html>
TIY
ıơ640û򷵻ıǷӦֻ          ֻֻû򷵻ıǷӦֻġ



÷
readOnly û򷵻ıǷΪֻ
﷨
textObject.readOnly=true|false
ʵ
ӽıΪֻ
<html>
<head>
<script type="text/javascript">
function makeReadOnly()
  {
  document.getElementById("text1").readOnly=true
  }
</script>
</head>
<body>

<form>
<input type="text" id="text1" value="Hello World!" />
<input type="button" onclick="makeReadOnly()" value="Make read-only" />
</form>

</body>
</html>
TIY
ıΪֻ640û򷵻ıĳߴ                  ߴߴû򷵻ıĳߴ硣



÷
size û򷵻ıĳߴ磨ַƣ
﷨
textObject.size=number_of_char
ʵ
ʾıĳߴ磺
<html>
<head>
<script type="text/javascript">
function fieldSize()
  {
  alert(document.getElementById("name").size)
  }
</script>
</head>

<body>
<form>
Name:
<input type="text" id="name" value="Mickey Mouse" size="20" maxlength="30" />
<br /><br />
<input type="button" onclick="fieldSize()" value="Alert size" />
</form>
</body>

</html>
TIY
ʾıĳߴַ640û򷵻ı tab ƴ       tabtabû򷵻ı tab ƴ



÷
tabIndex û򷵻ı tab ƴ
﷨
textObject.tabIndex=number
ʵ
ʾͬı tab ƴ
<html>
<head>
<script type="text/javascript">
function checkTab(x)
{
alert(x.tabIndex)
}
</script>
</head>
<body>

<form id="myForm">
<input type="text" tabindex="1" onclick="checkTab(this)">
<input type="text" tabindex="2" onclick="checkTab(this)">
<input type="text" tabindex="3" onclick="checkTab(this)">
</form>

</body>
</html>
TIY
ʾͬı tab ƴ640ııԪ                ͡͡ııԪ͡



÷
type ԷııԪ͡ı򣬸Ƿ "text"
﷨
textObject.type
ʵ
ӷııԪͣ
<html>
<body>

<form>
<input type="text" id="text1" />
</form>

<script type="text/javascript">
x=document.getElementById("text1");
document.write("Form element type is: ");
document.write(x.type);
</script>

</body>
</html>
TIY
ııԪ͡640û򷵻ı value Եֵ       ֵֵû򷵻ı value Եֵ




÷
value û򷵻ıֵ
﷨
textObject.value=text
ʵ
ӿɻıֵ
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  alert(document.getElementById("text1").value)
  }
</script>
</head>
<body>

<form>
<input type="text" id="text1" value="Hello world!" />
<input type="button" id="button1" onclick="alertValue()" 
value="Show default value" />
</form>

</body>
</html>
TIY
ıֵ
֤
еĵѡť
еĸѡť
еб
һб640ıƿ()                    ƽƽıƿ㡣



÷
blur() ڴıƿ㡣
﷨
textObject.blur()
ʵ
ӿúƿıϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('text1').focus()
  }
function loseFocus()
  {
  document.getElementById('text1').blur()
  }
</script>
</head>
<body>

<form>
<input type="text" id="text1" />
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
úƿıϵĽ640ıý()                    ıý㡣



÷
focus() ڸı򽹵㡣
﷨
textObject.focus()
ʵ
ӿúƿıϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('text1').focus()
  }
function loseFocus()
  {
  document.getElementById('text1').blur()
  }
</script>
</head>
<body>

<form>
<input type="text" id="text1" />
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
úƿıϵĽ640ѡȡıе()                    ѡȡѡȡѡȡıеݡ



÷
select() ѡȡıеݡ
﷨
textObject.select()
ʵ
ӿѡȡıеݣ
<html>
<head>
<script type="text/javascript">
function selText()
  {
  document.getElementById("myText").select()
  }
</script>
</head>
<body>

<form>
<input size="25" type="text" id="myText" value="A cat played with a ball">
<input type="button" value="Select text" onclick="selText()"> 
</form>

</body>
</html>
TIY
ѡȡıеݡ345ⲿԴⲿԴLink 
Link ĳ HTML  <link> Ԫء<link> Ԫؿɶĵ֮Ĺϵ
<link> Ԫر HTML ĵ head ֡
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.657û򷵻Ŀ URL ַ           ַַû򷵻Ŀ URL ַ롣



÷
The charset property sets or returns the character encoding of the target URL.
﷨
linkObject.charset=character-encoding
ʵ
The following example sets the character encoding of the target URL:
<html>
<head>
<link rel="stylesheet" type="text/css" id="style1"
href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
x.charset="ISO-8859-1";
document.write("Charset=" + x.charset);
</script>

</body>
</html>
TIY
Set the character encoding of a <link> element657û򷵻Ŀ URL Ƿ񵱱         ááû򷵻Ŀ URL Ƿ񵱱á



÷
The disabled property sets or returns whether or not the target URL should be disabled.
﷨
linkObject.disabled=true|false
ʵ
The following example disables the style sheet:
<html>
<head>
<link rel="stylesheet" type="text/css" 
id="style1" href="try_dom_link.css" />

<script type="text/javascript">
function disableStyle()
  {
  document.getElementById("style1").disabled=true
  }
</script>
</head>
<body>

<form>
<input type="button" id="button1" onclick="disableStyle()" 
value="Disable style sheet" />
</form>

</body>
</html>
TIY
Disable a style sheet657û򷵻رԴURL               URLURLû򷵻رԴ URL



÷
The href property sets or returns the URL of the linked resource.
﷨
linkObject.href=URL
ʵ
The following example changes style sheet:
<html>
<head>
<link rel="stylesheet" type="text/css" 
id="style1" href="try_dom_link.css" />

<script type="text/javascript">
function changeStyle()
{
document.getElementById("style1").href="try_dom_link2.css"
}
</script>
</head>
<body>

<form>
<input type="button" id="button1" onclick="changeStyle()" 
value="Change style sheet" />
</form>

</body>
</html>
TIY
Change a style sheet link657û򷵻Ŀ URL Ļ׼           û򷵻Ŀ URL Ļ׼ԡ



÷
The hreflang property sets or returns the base language of the target URL.
﷨
linkObject.hreflang=languagecode
ʵ
The following example returns the language code of the link element:
<html>
<head>
<link rel="stylesheet" type="text/css" 
hreflang="us-en" id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("Language code=" + x.hreflang);
</script>

</body>
</html>
TIY
Get the language code of a <link> element657û򷵻ĳ <link> Ԫص id         ididû򷵻ĳ <link> Ԫص id



÷
The id property sets or returns the id of a link element.
﷨
linkObject.id=id
ʵ
The following example outputs the id of a link element:
<html>
<head>
<link rel="stylesheet" type="text/css" 
id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("Id of link=" + x.id);
</script>

</body>
</html>
TIY
Get the id of a <link> element657û򷵻ĵʾ豸            豸豸û򷵻ĵʾ豸͡



÷
media û򷵻ʾĵ豸
ʽϢԣĿýǳҪƶ豸ʽǲͬġ
﷨
linkObject.media=device
豸ֵ֮һ
ֵ	
screen	ԲҳļĻ
tty	ʹõȿַý飨ֻն˻ʾ豸
tv	 TV ͵豸
projection	ͶӰ
handheld	ֳ豸
print	ԴӡԤģʽҳĵ
braille	äõַװá
aural	ϳɡ
all	豸װá
ʵ
ӻʹ link Ԫصýͣ
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen"
id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("Intended media type=" + x.media);
</script>

</body>
</html>
TIY
ʹ link Ԫصý͡657û򷵻 <link> Ԫص            ơơû򷵻 <link> Ԫصơ




÷
The name property sets or returns the name of a element.
﷨
linkObject.name=name
ʵ
The following example outputs the name of a link element:
<html>
<head>
<link rel="stylesheet" type="text/css" name="stylesheet" 
id="style1" href="try_dom_link.css" />

<script type="text/javascript">
function alertName()
  {
  alert(document.getElementById("style1").name);
  }
</script>
</head>
<body>

<form>
<input type="button" onclick="alertName()" 
value="Alert name attribute" />
</form>

</body>
</html>
TIY
Get the name attribute of a <link> element657û򷵻صǰĵĿ URL֮Ĺϵ  ϵϵû򷵻صǰĵĿ URL֮Ĺϵ




÷
The rel property sets or returns the relationship between the current document and the target URL.
The rel and rev properties work together. Those two properties are used by search engines to provide a linked navigation menu.
﷨
linkObject.rel=relationship
The rel property can have one of the following values:
Value	Description
appendix	Link to the appendix page of the document
alternate	Link to an alternative source of the document
bookmark	Link to a bookmark
chapter	Link to a chapter
contents	Link to the table of contents of the document
copyright	Link to copyright or the policy of the document
glossary	Link to the glossary page of the document
index	Link to the index page of the document
next	Link to the next page
prev	Link to the previous page
section	Link to a section in a list of documents
start	Link to the first page (used by search engines to show the first page)
stylesheet	Link to the style sheet of the document.
subsection	Link to a sub-section in a list of current documents
ʵ
The following example returns the relationship between the current document and the target URL:
<html>
<head>
<link rel="stylesheet" type="text/css" 
id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("Relationship: " + x.rel);
</script>

</body>
</html>
TIY
Return the relationship of a <link> element657û򷵻ĿURL뵱ǰĵ֮Ĺϵ   ϵϵû򷵻Ŀ URL 뵱ǰĵ֮Ĺϵ



÷
The rev property sets or returns the relationship between the target URL and the current document.
The rel and rev properties work together. Those two properties are used by search engines to provide a linked navigation menu.
﷨
linkObject.rev=relationship
The rel property can have one of the following values:
Value	Description
appendix	Link to the appendix page of the document
alternate	Link to an alternative source of the document
bookmark	Link to a bookmark
chapter	Link to a chapter
contents	Link to the table of contents of the document
copyright	Link to copyright or the policy of the document
glossary	Link to the glossary page of the document
index	Link to the index page of the document
next	Link to the next page
prev	Link to the previous page
section	Link to a section in a list of documents
start	Link to the first page (used by search engines to show the first page)
stylesheet	Link to the style sheet of the document.
subsection	Link to a sub-section in a list of current documents
ʵ
The following example returns the relationship between the target URL and the current document:
<html>
<head>
<link rev="subsection" id="link1" 
href="/htmldom/prop_link_rev.asp" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("link1");
document.write("Reverse relationship: " + x.rev);
document.write("<br />This page is a subsection of: ");
document.write(x.href);
</script>

</body>
</html>
TIY
Return the reverse relationship of a <link> element657û򷵻ĿURLMIME             ͡͡û򷵻Ŀ URL  MIME ͡



÷
The type property sets or returns the MIME type of the target URL (like "text/css", "text/javascript", "image/gif", etc.).
﷨
linkObject.type=MIME_type
ʵ
The following example returns the MIME type of the target URL:
<html>
<head>
<link rel="stylesheet" type="text/css" 
id="style1" href="try_dom_link.css" />
</head>
<body>

<script type="text/javascript">
x=document.getElementById("style1");
document.write("MIME type: " + x.type);
</script>

</body>
</html>
TIY
Get the MIME type of a <link> element345ҪҪMeta 
Meta  HTML  һ <meta> Ԫء
<meta> Ԫؿṩйĳ HTML ԪصԪϢ (meta-information)ĹؼԼˢƵʡ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.668û򷵻<meta>Ԫcontentֵ       contentcontentû򷵻 <meta> Ԫص content Եֵ




÷
content û򷵻 <meta> Ԫص content Եֵ
﷨
metaObject.content=text
ʵ
 <meta> ǩΪ涨һЩؼʡ´뷵 content Եֵ
<html>
<head>
<meta name="keywords" content="HTML,DHTML,CSS,JavaScript" />
</head>
<body>

<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Meta content: " + x.content);
</script>

</body>
</html>
TIY
 <meta> Ԫص content Եֵ668contentӵһHTTPͷ         httpEquivhttpEquiv content ӵһ HTTP ͷ



÷
httpEquiv ԰ content ӵ HTTP ͷ
﷨
metaObject.httpEquiv=content-type|expires|refresh|set-cookie
ʵ
ÿ 5 ˢҳ棺
<html>
<head>
<meta http-equiv="refresh" content="5" />
</head>
<body>

<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Http equiv: " + x.httpEquiv);
</script>

</body>
</html>
TIY
ÿ 5 ˢҳ
5 ضҳ668 content ӵĳ           ơơ content ӵĳơ



÷
name ԰ content ӵ name
﷨
metaObject.name=author|description|keywords|generator|revised|others
ʵ
 <meta> ǩΪ涨һЩؼʡ´뷵 content Եֵ
<html>
<head>
<meta name="keywords" content="HTML,DHTML,CSS,JavaScript" />
</head>
<body>

<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Meta name: " + x.name);
</script>

</body>
</html>
TIY
 <meta> Ԫص content Եơ668û򷵻ڽcontentԵֵĸʽ schemeschemeû򷵻ڽ content Եֵĸʽ



÷
scheme û򷵻ڽ content Եֵĸʽ
﷨
metaObject.scheme=format
ʵ
ڽ content Եֵĸʽ
<html>
<head>
<meta name="revised" content="2006-11-03" scheme="YYYY-MM-DD" />
</head>

<body>

<script type="text/javascript">
x=document.getElementsByTagName("meta")[0];
document.write("Content format: " + x.scheme);
</script>

</body>

</html>
TIY
 <meta> Ԫ content ĸʽ345ǩǩObject 
Object  HTML  <object> Ԫء
<object> Ԫҳа󣬱磺ͼƵƵJava appletActiveXPDFFlash ȡ673û򷵻ضΧıĶ뷽ʽ  û򷵻ضΧıĶ뷽ʽ673û򷵻ַʵֶĴ浵      archivearchiveû򷵻һַʵֶĴ浵ܡ673û򷵻Χƶı߿                û򷵻Χƶı߿򡣡673û򷵻ļURLļJava       codecodeû򷵻ļ URLļѱ Java ࡣ673û򷵻 URL                    codeBasecodeBaseû򷵻 URL673codeType                                codeTypecodeTypecodeType673 data                                   datadata data673 declare                                declaredeclare declare673ضԶĸ                ضԶĸá673û򷵻ضĸ߶                    ȫߡȫߡû򷵻ضĸ߶ȡ673û򷵻ضˮƽ߾              ͼաͼաû򷵻ضˮƽ߾ࡣ673û򷵻ض                    ơơû򷵻ضơ673û򷵻ڼضʱصϢ        standbystandbyû򷵻ڼضʱصϢ673û򷵻ͨdata  ͡͡û򷵻ͨ data صݵ͡673 useMap                                 ͼͼ useMap673û򷵻ضĴֱ߾              ͼաͼաû򷵻ضĴֱ߾ࡣ673û򷵻ضĿ                    ȫȫû򷵻ضĿȡ345ѡѡOption 
Option  HTML беһѡ
 HTML  <option> ǩÿһΣһ Option ͻᱻ
ͨ elements[] һ Option 󣬻ͨʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.691selectedԵĬֵ                ǷĬϡǷĬϡ selected  ԵĬֵ



÷
defaultSelected Կɷ selected Եĳʼֵ
ѡĬϵѡ򷵻 true򷵻 fasle
ã selected ΪԵֵҲ selected Եֵ
עͣĬϵѡʾڵһλ
﷨
optionObject.defaultSelected
ʵ
ӿɼѡǷĬѡ
<html>
<head>
<script type="text/javascript">
function alertDefaultSelected()
  {
  var x=document.getElementById("mySelect").selectedIndex;
  var y=document.getElementsByTagName("option");
  var txt="Is " + y[x].text + " selected by default? ";
  txt=txt + y[x].defaultSelected;
  alert(txt);
  }
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
  <option>Apple</option>
  <option>Orange</option>
  <option selected="selected">Pineapple</option>
  <option>Banana</option>
</select>
<br />
<br />
<input type="button" onclick="alertDefaultSelected()"
value="Is the chosen fruit selected by default?">
</form>

</body>
</html>
TIY
ѡǷĬѡ691û򷵻ѡǷӦ              ááû򷵻ѡǷӦá


÷
disabled Կû򷵻ǷĬϵؽĳ <option> Ԫء
עͣ disabled  IE вá
Ϊ true <option> Ԫؽãû޷ѡˡ
ӳ HTML  disabled
﷨
optionObject.disabled=true|false
ʵ
ӿʾѡˮǷĬϵؽã
<html>
<head>
<script type="text/javascript">
function alertDefaultDisabled()
  {
  var x=document.getElementById("mySelect").selectedIndex;
  var y=document.getElementsByTagName("option");
  alert("Is " + y[x].text + " disabled by default? " + y[x].disabled);
  }
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
<option>Apple</option>
<option>Orange</option>
<option disabled="disabled">Pineapple</option>
<option>Banana</option>
</select>
<br />
<br />
<input type="button" onclick="alertDefaultDisabled()"
value="Is the chosen fruit disabled by default?">
</form>

</body>
</html>
TIY
ĳѡǷĬϵؽ
ͨ id ĳѡ691ض԰Ԫص <form> Ԫص    ض԰Ԫص <form> Ԫصá



÷
form Կɷض԰ѡıá
﷨
optionObject.form
ʵ
<html>
<body>

<form id="myForm">
<select id="mySelect">
  <option id="apple">Apple</option>
  <option id="orange">Orange</option>
  <option id="pineapple">Pineapple</option>
  <option id="banana">Banana</option>
</select>
</form>

<p>The id of the form is:
<script type="text/javascript">
document.write(document.getElementById("apple").form.id)
</script>
</p>

</body>
</html>
TIY
ȡðбѡı id691û򷵻ѡ id                     ididû򷵻ѡ id



÷
id Կû򷵻бѡ id
﷨
optionObject.id=id
ʵ
ӿɷбѡѡ id
<html>
<head>
<script type="text/javascript">
function alertOptionId()
{
var x=document.getElementById("mySelect").selectedIndex;
alert(document.getElementsByTagName("option")[x].id);
}
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
  <option id="apple">Apple</option>
  <option id="orange">Orange</option>
  <option id="pineapple">Pineapple</option>
  <option id="banana">Banana</option>
</select>
<br /><br />
<input type="button" onclick="alertOptionId()" value="Alert id">
</form>

</body>
</html>
TIY
ȡбѡѡ id691бĳѡλ        бĳѡλá




÷
index Կɷбѡλá
﷨
optionObject.index
ʵ
ɷбѡѡλã
<<html>
<head>
<script type="text/javascript">
function alertIndex()
{
var x=document.getElementById("mySelect").selectedIndex;
var y=document.getElementsByTagName("option");
alert(y[x].text + " has the index of: " + y[x].index);
}
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
  <option>Apple</option>
  <option>Orange</option>
  <option>Pineapple</option>
  <option>Banana</option>
</select>
<br />
<br />
<input type="button" onclick="alertIndex()"
value="Show index of the chosen fruit">
</form>

</body>
</html>
TIY
ȡбѡѡλá691û򷵻ѡı                    ǡǡû򷵻ѡı ѡ飩691û򷵻selectedԵֵ              ѡѡû򷵻 selected Եֵ



÷
selected Կû򷵻ѡ selected Եֵ
ѡĵǰ״̬Ϊ trueѡѡСԵĳʼֵ <option>  selected ԡ
﷨
optionObject.selected=true|false
ʵ
ɸбеıѡѡ
<html>
<head>
<script type="text/javascript">
function selectOrange()
{
document.getElementById("orange").selected=true;
}
</script>
</head>

<body>
<form>
Select your favorite fruit:
<select>
<option id="apple">Apple</option>
<option id="orange">Orange</option>
<option id="pineapple" selected="selected">Pineapple</option>
<option id="banana">Banana</option>
</select>
<br /><br />
<input type="button" onclick="selectOrange()" value="Select Orange">
</form>
</body>
</html>
TIY
ıѡѡ691û򷵻ĳѡĴıֵ            ııû򷵻ĳѡĴıֵ



÷
text Կû򷵻ѡıֵ
û򷵻صǰ <option> ԪеĴııΪѡıǩ֡
﷨
optionObject.text=sometext
ʵ
ӷбѡı
<html>
<head>
<script type="text/javascript">
function getOptions()
  {
  var x=document.getElementById("mySelect");
  var y="";
  for (i=0;i<x.length;i++)
    {
    y+=x.options[i].text;
    y+="<br />";
    }
  document.write(y);
  }
</script>
</head>

<body>

<form>
ѡϲˮ
<select id="mySelect">
  <option>ƻ</option>
  <option></option>
  <option>㽶</option>
  <option></option>
</select>
<br /><br />
<input type="button" onclick="getOptions()" value="ѡ">
</form>

</body>
</html>
һ
TIY
бѡı
ббѡѡı691û򷵻رֵ              ֵֵû򷵻رֵ




÷
value Կû򷵻ѡֵ
ύʱѡѡУvalue ͱһύӳ <option>  value ԡ
﷨
optionObject.value=somevalue
ʵ
ӿɷرѡѡı
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  var x=document.getElementById("mySelect").selectedIndex;
  alert(document.getElementsByTagName("option")[x].value);
  }
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
  <option value="apple">Apple</option>
  <option value="orange">Orange</option>
  <option value="pineapple">Pineapple</option>
  <option value="banana">Banana</option>
</select>
<br /><br />
<input type="button" onclick="alertValue()" value="Alert selected value">
</form>

</body>
</html>
TIY
رѡѡı345Select 
Select  HTML еһб
 HTML У<select> ǩÿһΣһ Select ͻᱻ
ͨ elements[] ĳ Select 󣬻ʹ document.getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.701ذбѡۼϣ  ѡѡذбеѡһ顣



÷
option Ͽɷذ <select> Ԫ <option> һ顣
עͣеÿԪضӦһ <option> ǩ -  0 ʼ
﷨
selectObject.options[]
˵
options[] ϲһͨ HTMLcollectionΪ˺ڵݣĳΪͨ Select ıʾѡ
 options.length Ϊ 0,Select ѡᱻ
 options.length ԵֵȵǰֵСβԪؾͻᱻ
 options[] еһԪΪ nullôѡͻ Select ɾ
ͨ캯 Option() һµ option Ҫ options.length ԣ
ʵ
ӷбѡı
<html>
<head>
<script type="text/javascript">
function getOptions()
  {
  var x=document.getElementById("mySelect");
  var y="";
  for (i=0;i<x.length;i++)
    {
    y+=x.options[i].text;
    y+="<br />";
    }
  document.write(y);
  }
</script>
</head>

<body>

<form>
ѡϲˮ
<select id="mySelect">
  <option>ƻ</option>
  <option></option>
  <option>㽶</option>
  <option></option>
</select>
<br /><br />
<input type="button" onclick="getOptions()" value="ѡ">
</form>

</body>
</html>
һ
TIY
бѡı
ббѡѡı701û򷵻ǷӦб            ááû򷵻ǷӦб



ʵ
б
<script>

document.getElementById("mydrop").disabled=true;

</script>
ǣ

һ
÷
disabled û򷵻Ƿб
õԪزҲɵԪͨʾΪɫ
﷨
 disabled ԣ
element.disabled=true|false
 disabled ԣ
element.disabled
֧
֧ disabled ԡ701ض԰бı          ض԰бıá




÷
form Կɷض԰бıԪصá
﷨
selectObject.form
ʵ
<html>
<body>

<form id="myForm">
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>

<p>The id of the form is:
<script type="text/javascript">
document.write(document.getElementById("mySelect").form.id)
</script>
</p>

</body>
</html>
TIY
ȡðбı id701û򷵻б id                 ididû򷵻б id




÷
id Կû򷵻б id
﷨
selectObject.id=id
ʵ
ӿɷб id
<html>
<body>

<form id="myForm">
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
</form>

<p>The id of the dropdown list is:
<script type="text/javascript">
document.write(document.getElementById("mySelect").id)
</script>
</p>

</body>
</html>
TIY
ȡб id701беѡĿ                ѡѡбеѡĿ




÷
length ԿɷбѡĿ
﷨
selectObject.length=number
ʵ
ӿɷб id
<html>
<head>
<script type="text/javascript">
function getLength()
  {
  alert(document.getElementById("mySelect").length)
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="getLength()"
value="How many options in the list?">
</form>

</body>
</html>
TIY
ȡбѡĿ701û򷵻ǷѡĿ              ԶѡԶѡû򷵻ǷѡĿ



÷
multiple Կû򷵻ǷжѡѡС
עͣOpera 9 ޷ڽűøԣܷ
﷨
selectObject.multiple=true|false
ʵ
The following example returns the id of the dropdown list:
<html>
<head>
<script type="text/javascript">
function selectMultiple()
  {
  document.getElementById("mySelect").multiple=true
  }
</script>
</head>
<body>

<form>
<select id="mySelect" size="4">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="selectMultiple()"
value="Select multiple">
</form>

</body>
</html>
TIY
ѡбеĶѡ701û򷵻б                ơơû򷵻бơ




÷
name Կû򷵻бơ
﷨
selectObject.name=name
ʵ
ӿʾбƣ
<html>
<head>
<script type="text/javascript">
function getName()
  {
  alert(document.getElementById("mySelect").name)
  }
</script>
</head>
<body>

<form>
<select name="mySelect" id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="getName()" 
value="Alert name">
</form>

</body>
</html>
TIY
ȡбơ701û򷵻ббѡĿ    ѡѡû򷵻ббѡĿš



÷
selectedIndex Կû򷵻ббѡѡš
עͣѡ᷵صһѡѡš
﷨
selectObject.selectedIndex=number
ʵ
ӿʾѡѡţ
<html>
<head>
<script type="text/javascript">
function getIndex()
  {
  var x=document.getElementById("mySelect")
  alert(x.selectedIndex)
  }
</script>
</head>
<body>

<form>
Select your favorite fruit:
<select id="mySelect">
  <option>Apple</option>
  <option>Orange</option>
  <option>Pineapple</option>
  <option>Banana</option>
</select>
<br /><br />
<input type="button" onclick="getIndex()"
value="Alert index of selected option">
</form>

</body>
</html>
TIY
ʾѡѡ
ббѡѡı
бɾѡ701û򷵻беĿɼ          ߴߴû򷵻беĿɼ




÷
size Կû򷵻бһʾʾѡ
עͣOpera 9 ޷ڽűøԣܷ
﷨
selectObject.size=number
ʵ
<html>
<head>
<script type="text/javascript">
function changeSize()
  {
  document.getElementById("mySelect").size=4
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Banana</option>
  <option>Orange</option>
  <option>Melon</option>
</select>
<input type="button" onclick="changeSize()"
value="Change size">
</form>

</body>
</html>
TIY
беĿɼ701û򷵻б tab ƴ     tabtabû򷵻б tab ƴ



÷
tabIndex Կбе tab ƴ
﷨
selectObject.tabIndex=number
ʵ
ӽʾһıһб tab ƴ
<html>
<head>
<script type="text/javascript">
function showTabIndex()
  {
  var email=document.getElementById('email').tabIndex;
  var sex=document.getElementById('sex').tabIndex;
  document.write("Tab index of email field: " + email);
  document.write("<br />");
  document.write("Tab index of dropdown list: " + sex);
  }
</script>
</head>
<body>

<form>
Email: <input type="text" id="email" tabindex="1" />
<br />
Sex:
<select id="sex" tabindex="2">
<option>Male</option>
<option>Female</option>
</select>
<br /><br />
<input type="button" onclick="showTabIndex()"
value="Show tabIndex" />
</form>

</body>
</html>
TIY
ʾ tab ƴ701бı                  ͡͡бı͡



÷
type Կɷбı͡б "select-one"  "select-multiple"
﷨
selectObject.type
ʵ
ӷбıͣ
<html>
<head>
<script type="text/javascript">
function getType()
  {
  alert(document.getElementById("mySelect").type)
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="getType()" 
value="Alert type of dropdown list">
</form>
</body>
</html>
TIY
ȡб͡701бһѡ()                бһѡ




÷
add()  <select> һ <option> Ԫء
﷨
selectObject.add(option,before)
	
option	衣ҪѡԪء option  optgroup Ԫء
before	衣ѡĸԪ֮ǰµԪءònullԪӵѡĩβ
ʵ
ӿбĩβһ "kiwi" ѡ
<html>
<head>
<script type="text/javascript">
function insertOption()
  {
  var y=document.createElement('option');
  y.text='Kiwi'
  var x=document.getElementById("mySelect");
  try
    {
    x.add(y,null); // standards compliant
    }
  catch(ex)
    {
    x.add(y); // IE only
    }
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="insertOption()"
value="Insert option" />
</form>

</body>
</html>
TIY
һѡӵбĩβ
бıѡѡ֮ǰѡ701бƿ()                    ƽƽбƿ㡣




÷
blur() ڴбƿ㡣
﷨
selectObject.blur()
ʵ
ӿûбƿ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('select1').focus()
  }
function loseFocus()
  {
  document.getElementById('select1').blur()
  }
</script>
</head>
<body>

<form>
<select id="select1">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<br /><br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</form>

</body>
</html>
TIY
òбƿ701бý()                  бý㡣



÷
focus() ڸб㡣
﷨
selectObject.focus()
ʵ
ӿΪбý㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('select1').focus()
  }
</script>
</head>
<body>

<form>
<select id="select1">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<br /><br />
<input type="button" onclick="setFocus()" value="Set focus" />
</form>

</body>
</html>
TIY
òбƿ701бɾһѡ()              ɾɾбɾһѡ




÷
remove() ڴбɾѡ
﷨
selectObject.remove(index)
	
index	衣涨Ҫɾѡš
˵
÷ѡָλƳ <option> Ԫءָ± 0 СߴڻѡĿremove() ʲôҲ
ʵ
ӿɴбɾѡѡ
<html>
<head>
<script type="text/javascript">
function removeOption()
  {
  var x=document.getElementById("mySelect")
  x.remove(x.selectedIndex)
  }
</script>
</head>
<body>

<form>
<select id="mySelect">
  <option>Apple</option>
  <option>Pear</option>
  <option>Banana</option>
  <option>Orange</option>
</select>
<input type="button" onclick="removeOption()"
value="Remove option">
</form>

</body>
</html>
TIY
бɾѡѡ
бɾѡ701ıѡʱõ¼    ¼ġġıѡʱõ¼


÷
ıѡʱõ¼
﷨
selectObject.onchange
˵
Select  onchange һ¼ûѡһѡȡ˶һѡѡʱͻøþ¼ָµѡʲôͨ Select  selectedIndex ԣ߸ Option  selected ȷһ㡣345ʽʽStyle 
Style һʽɴӦʽĵԪط Style 
ʹ Style Ե﷨
document.getElementById("id").style.property="ֵ"
Style ԣ

߿ͱ߾

б

λ
ӡ


ı
淶
IE: Internet Explorer, M:  Mac IE, W:  Windows IE, F: Firefox, O: Opera
W3C: ά World Wide Web Consortium (Internet ׼).



cssText 
һʽԼֵıʾıʽΪһ CSS ʽȥ˰ΧԺֵԪѡĻš
һΪǷֵ׳һΪ SYNTAX_ERR  DOMException 쳣 CSS2Properties ֻʱͼһԽ׳һΪ NO_MODIFICATION_ALLOWED_ERR  DOMException 쳣
 CSS2Properties 
CSS2Properties ʾһ CSS ʽԼֵΪ CSS 淶ÿһ CSS Զһ JavaScript ԡ
һ HTMLElement  style һɶд CSS2Properties 󣬾ͺ CSSRule  style һWindow.getComputedStyle() ķֵһ CSS2Properties ֻġ
ҳ
XML DOM οֲ᣺CSS2Properties 
οֲ᣺CSS οֲ


718һеı              һеı



÷
background һеıԡ
﷨
Object.style.background=background-color background-image
background-repeat background-attachment background-position
		ֵ
background-color	Ԫصıɫ	
color-name
color-rgb
color-hex
transparent
background-image	ñͼ	
url(URL)
none
background-repeat	ñͼǷظ	
repeat
repeat-x
repeat-y
no-repeat
background-attachment	ͼǷ̶ҳಿֹ	
scroll
fixed
background-position	ñͼʼλá	
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
x% y%
xpos ypos
ʵ
Ӹıĵʽ
<html>
<head>
<script type="text/javascript">
function setStyle()
{
document.body.style.background="#FFCC80 url(bgdesert.jpg) repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="setStyle()"
value="Set background style" />

</body>
</html>
TIY
ıĵʽ718ñͼǷ̶ҳ        ͼ̶ͼ̶ñͼǷ̶ҳ



÷
backgroundAttachment ñͼǷ̶ҳಿֹ
﷨
Object.style.backgroundAttachment=scroll|fixed
ʾע
ʾһֿõıɫĻ米ͼ񲻿ãҳҲɻõӾЧ
ʵ
ڵťѱͼΪ̶
<html>
<head>
<style type="text/css">
body
{
background-color="#FFCC80";
background-image:url(bgdesert.jpg);
}
p
{
color:white;
}
</style>
<script type="text/javascript">
function changeAttachment()
{
document.body.style.backgroundAttachment="fixed";
}
</script>

</head>
<body>

<input type="button" onclick="changeAttachment()"
value="Set background-image to be fixed" />
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>
TIY
ѱͼΪ̶718Ԫصıɫ                      ɫɫԪصıɫ



÷
backgroundColor Ԫصıɫ
﷨
Object.style.backgroundColor=color-name|color-rgb
|color-hex|transparent
ʵ
 body ıɫ
<html>
<head>
<style type="text/css">
body
{
background-color:#B8BFD8;
}
</style>
<script type="text/javascript">
function changeStyle()
{
document.body.style.backgroundColor="#FFCC80";
}
</script>
</head>
<body>

<input type="button" onclick="changeStyle()"
value="Change background color" />

</body>
</html>
TIY
ı䱳ɫʮƣ
ı䱳ɫɫ718Ԫصıͼ                      ͼͼԪصıͼ



÷
backgroundImage Ԫصıͼ
﷨
Object.style.backgroundImage=url(URL)|none
	
url(URL)	ͼ·
none	ޱͼ
ʾע
ʾһֿõıɫĻ米ͼ񲻿ãҳҲɻõӾЧ
ʵ
˱ͼ
<html>
<head>
<script type="text/javascript">
function changeStyle()
{
document.body.style.backgroundColor="#FFCC80";
document.body.style.backgroundImage="url(bgdesert.jpg)";
}
</script>
</head>
<body>

<input type="button" onclick="changeStyle()"
value="Set background image" />

</body>
</html>
TIY
ñͼ718ñͼʼλ                  ͼʼͼʼñͼʼλ



÷
backgroundPosition ñͼλá
﷨
Object.style.backgroundPosition=position
	
top left
top center
top right
center left
center center
center right
bottom left
bottom center
bottom right
涨һؼʣôڶֵ"center"
Ĭֵ0% 0%
x% y%	
һֵˮƽλãڶֵǴֱλá
Ͻ 0% 0%½ 100% 100%
涨һֵһֵ 50%
xpos ypos	
һֵˮƽλãڶֵǴֱλá
Ͻ 0 0λ (0px 0px) κ CSS λ
涨һֵһֵ50%
Իʹ %  position ֵ
ʵ
ı䱳ͼλã
<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.jpg);
background-repeat:no-repeat
}
</style>
<script type="text/javascript">
function changePosition()
{
document.body.style.backgroundPosition="bottom center";
}
</script>
</head>
<body>

<input type="button" onclick="changePosition()"
value="Change background-image position" />

</body>
</html>
TIY
ı䱳ͼλá718backgroundPositionԵX       ʼʼbackgroundPositionԵX



÷
backgroundPositionX ñͼˮƽλá
﷨
Object.style.backgroundPositionX=position
	
left
center
right
ˮƽλá
x%	ˮƽλá 0% 100%
xpos	ˮƽλá 0λ (0px)  CSS λ
ʵ
ı˱ͼˮƽλã
<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.jpg);
background-repeat:no-repeat
}
</style>
<script type="text/javascript">
function changePosition()
{
document.body.style.backgroundPositionX="right";
}
</script>
</head>
<body>

<input type="button" onclick="changePosition()"
value="Change background-image's x-position" />

</body>
</html>
TIY
ı䱳ͼˮƽλá718backgroundPositionԵY       ʼʼbackgroundPositionԵY




÷
backgroundPositionY  background-image Ĵֱλá
﷨
Object.style.backgroundPositionY=position
	
top
center
bottom
ֱλá
y%	ֱλáTop  0%Bottom  100%
ypos	ֱλáTop  0λ (0px)  CSS λ
ʵ
Ӹı background-image Ĵֱλã
<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.jpg);
background-repeat:no-repeat
}
</style>
<script type="text/javascript">
function changePosition()
{
document.body.style.backgroundPositionY="bottom";
}
</script>
</head>
<body>

<input type="button" onclick="changePosition()"
value="Change background-image's y-position" />

</body>
</html>
TIY
ı background-image Ĵֱλá718Ƿظͼ              ͼظͼظǷظͼ


ͼظȫ
ͼظ
ͼظ
ͼظ



÷
backgroundRepeat ñͼǷظ
﷨
Object.style.backgroundRepeat=repeat_value
	
repeat	Ĭϡͼڴֱˮƽظ
repeat-x	ͼˮƽظ
repeat-y	ͼڴֱظ
no-repeat	ͼ񽫽ʾһΡ
ʵ
 y ظͼ
<html>
<head>
<style type="text/css">
body
{
background-color:#FFCC80;
background-image:url(bgdesert.jpg);
}
</style>
<script type="text/javascript">
function changeRepeat()
{
document.body.style.backgroundRepeat="repeat-y";
}
</script>
</head>
<body>

<input type="button" onclick="changeRepeat()"
value="Repeat background-image only on the y-axis" />

</body>
</html>
TIY
ı background-image  repeat ԡ718һĸ߿            ߿߿һĸ߿



÷
border һб߿ԡ
﷨
Object.style.border=borderWidth borderStyle borderColor
ֵ		ֵ
borderWidth	ñ߿Ŀȡ	
thin
medium
thick
length
borderStyle	ñ߿ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
borderColor	ñ߿ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
ıԪصı߿
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.border="thick solid #0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
border - ıԪصı߿718һõױ߿              ױ߿ױ߿һõױ߿



÷
borderBottom һΪ±߿еԡ
﷨
Object.style.borderBottom=borderWidth borderStyle borderColor
ֵ		ֵ
borderWidth	ñ߿Ŀȡ	
thin
medium
thick
length
borderStyle	ñ߿ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
borderColor	ñ߿ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
±߿
<html>
<head>
<style type="text/css">
p {border: thin dotted #FF0000}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderBottom="thick solid blue";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change bottom paragraph border" />
<p id="p1">This is a paragraph with a border</p>

</body>
</html>
TIY
borderBottom - ıԪص±߿718õױ߿ɫ                        ׿ɫ׿ɫõױ߿ɫ



÷
borderBottomColor Ԫص±߿ɫ
﷨
Object.style.borderBottomColor=color-name|color-rgb|color-hex
ʵ
ı±߿ɫ
<html>
<head>
<style type="text/css">
p {border: thick solid #FF0000}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderBottomColor="blue";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()"
value="Change border color" />
<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderBottomColor - ı±߿ɫ718õױ߿ʽ                        ׿ʽ׿ʽõױ߿ʽ



÷
borderBottomStyle ±߿ʽ
﷨
Object.style.borderBottomStyle=style
ֵ	
none	ޱ߿
hidden	 "none" ͬӦڱʱ⣬ڱhidden ڽ߿ͻ
dotted	״߿ڴгΪʵߡ
dashed	ߡڴгΪʵߡ
solid	ʵߡ
double	˫ߡ˫ߵĿȵ border-width ֵ
groove	 3D ۱߿Чȡ border-color ֵ
ridge	 3D ¢״߿Чȡ border-color ֵ
inset	 3D inset ߿Чȡ border-color ֵ
outset	 3D outset ߿Чȡ border-color ֵ
ʵ
ı±߿ʽ
<html>
<head>
<style type="text/css">
p
{ 
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderBottomStyle="dotted";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change bottom border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderBottomStyle - ı±߿ʽ718õױ߿Ŀ                        ׿׿õױ߿Ŀ



÷
borderBottomWidth ±߿Ŀȡ
﷨
Object.style.borderBottomWidth=thin|medium|thick|length
ֵ	
thin	ϸ±߿
medium	Ĭϡеȵ±߿
thick	ֵ±߿
length	Զ±߿Ŀȡ
ʵ
ı±߿Ŀȣ
<html>
<head>
<style type="text/css">
p
{ 
border: thin solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderWidth()
{
document.getElementById("p1").style.borderBottomWidth="thick";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderWidth()"
value="Change bottom border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderBottomWidth - ı±߿Ŀȡ718ĸ߿ɫ                  ɫɫĸ߿ɫ (ɫ)



÷
borderColor ԪΧ߿ɫ
Կʹ 1  4 ɫ
涨һɫ table {border-color: red} - еı߿Ǻɫ
涨ɫ table {border-color: red green} - ϱ߿±߿Ǻɫ߿ұ߿ɫ
涨ɫ table {border-color: red green blue}- ϱ߿Ǻɫ߿ұ߿ɫ±߿ɫ
涨ɫ table {border-color: red green blue yellow} - ϱ߿Ǻɫұ߿ɫ±߿ɫ߿ǻɫ
﷨
Object.style.borderColor=color-name|color-rgb|color-hex|transparent
ʵ
ı߿ɫ
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderColor="#0000FF #00FF00";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()"
value="Change border color" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderColor - ı߿ɫ718һ߿              ߿߿һ߿



÷
borderLeft һΪ߿ԡ
﷨
Object.style.borderLeft=borderWidth borderStyle borderColor
ֵܵ
ֵ		ֵ
borderWidth	ñ߿Ŀȡ	
thin
medium
thick
length
borderStyle	ñ߿ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
borderColor	ñ߿ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
ı߿Ŀȡʽɫ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderLeft="thick solid #0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change left border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderLeft - ı߿Ŀȡʽɫ718߿ɫ                        ɫɫ߿ɫ



÷
borderLeftColor Ԫص߿ɫ
﷨
Object.style.borderLeftColor=color-name|color-rgb|color-hex|transparent
ʵ
ı߿ɫ
<html>
<head>
<style type="text/css">
p
{ 
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderLeftColor="#0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()"
value="Change left border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderleftColor - ı߿ɫ718߿ʽ                        ʽʽ߿ʽ



÷
borderLeftStyle ߿ʽ
﷨
Object.style.borderLeftStyle=style
ֵܵ
ֵ	
none	ޱ߿
hidden	 "none" ͬӦڱʱ⣬ڱhidden ڽ߿ͻ
dotted	״߿ڴгΪʵߡ
dashed	ߡڴгΪʵߡ
solid	ʵߡ
double	˫ߡ˫ߵĿȵ border-width ֵ
groove	 3D ۱߿Чȡ border-color ֵ
ridge	 3D ¢״߿Чȡ border-color ֵ
inset	 3D inset ߿Чȡ border-color ֵ
outset	 3D outset ߿Чȡ border-color ֵ
ʵ
߿ʽ
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderLeftStyle="dotted";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change left border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderLeftStyle - ı߿ʽ718߿Ŀ                        ߿Ŀ



÷
borderLeftWidth ߿Ŀȡ
﷨
Object.style.borderLeftWidth=thin|medium|thick|length
ֵܵ
ֵ	
thin	ϸ±߿
medium	Ĭϡеȵ±߿
thick	ֵ±߿
length	Զ±߿Ŀȡ
ʵ
ı߿Ŀȣ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #FF0000;
}
</style>
<script type="text/javascript">
function changeBorderWidth()
{
document.getElementById("p1").style.borderLeftWidth="thick";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderWidth()"
value="Change left border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderLeftWidth - ı߿Ŀȡ718һұ߿              ұ߿ұ߿һұ߿



÷
borderRight һΪұ߿ԡ
﷨
Object.style.borderRight=borderWidth borderStyle borderColor
ֵܵ
ֵ		ֵ
borderWidth	ñ߿Ŀȡ	
thin
medium
thick
length
borderStyle	ñ߿ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
borderColor	ñ߿ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
ıұ߿Ŀȡʽɫ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderRight="thick solid #0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change right border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderRight - ıұ߿Ŀȡʽɫ718ұ߿ɫ                        ҿɫҿɫұ߿ɫ



÷
borderRightColor ұ߿ɫ
﷨
Object.style.borderRightColor=color-name|color-rgb|color-hex|transparent
ʵ
ıұ߿ɫ
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderRightColor="#0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()"
value="Change right border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderRightColor - ıұ߿ɫ718ұ߿ʽ                        ҿʽҿʽұ߿ʽ



÷
borderRightStyle ұ߿ʽ
﷨
Object.style.borderRightStyle=style
ֵܵ
ֵ	
none	ޱ߿
hidden	 "none" ͬӦڱʱ⣬ڱhidden ڽ߿ͻ
dotted	״߿ڴгΪʵߡ
dashed	ߡڴгΪʵߡ
solid	ʵߡ
double	˫ߡ˫ߵĿȵ border-width ֵ
groove	 3D ۱߿Чȡ border-color ֵ
ridge	 3D ¢״߿Чȡ border-color ֵ
inset	 3D inset ߿Чȡ border-color ֵ
outset	 3D outset ߿Чȡ border-color ֵ
ʵ
ıұ߿ʽ
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderRightStyle="dotted";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change right border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderRightStyle - ıұ߿ʽ718ұ߿Ŀ                        ҿҿұ߿Ŀ



÷
borderRightWidth Ԫصұ߿Ŀȡ
﷨
Object.style.borderRightWidth=thin|medium|thick|length
Possible Values
ֵ	
thin	ϸ±߿
medium	Ĭϡеȵ±߿
thick	ֵ±߿
length	Զ±߿Ŀȡ
ʵ
ıұ߿Ŀȣ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderWidth()
{
document.getElementById("p1").style.borderRightWidth="thick";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderWidth()"
value="Change right border width" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderRightWidth - ıұ߿Ŀȡ718ĸ߿ʽ                  ߿ʽ߿ʽĸ߿ʽ (ʽ)



÷
borderStyle һΪĸû򷵻ر߿ʽ
Կʹ 1  4 ʽ
﷨
Object.style.borderStyle=style
ֵܵ
ֵ	
none	ޱ߿
hidden	 "none" ͬӦڱʱ⣬ڱhidden ڽ߿ͻ
dotted	״߿ڴгΪʵߡ
dashed	ߡڴгΪʵߡ
solid	ʵߡ
double	˫ߡ˫ߵĿȵ border-width ֵ
groove	 3D ۱߿Чȡ border-color ֵ
ridge	 3D ¢״߿Чȡ border-color ֵ
inset	 3D inset ߿Чȡ border-color ֵ
outset	 3D outset ߿Чȡ border-color ֵ
ʵ
ı߿ʽ
<html>
<head>
<style>
p
{ 
border: thick solid #FF0000
}
</style>

<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderStyle="dotted double";
}
</script>

</head>
<body>

<form>
<input type="button" onclick="changeBorder()" 
value="Change paragraph border style" />
</form>

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
ı߿ʽ718һö߿              ߿߿һö߿



÷
borderTop һΪϱ߿еԡ
﷨
Object.style.borderTop=borderWidth borderStyle borderColor
ֵܵ
ֵ		ֵ
borderWidth	ñ߿Ŀȡ	
thin
medium
thick
length
borderStyle	ñ߿ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
borderColor	ñ߿ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
ıϱ߿Ŀȡʽɫ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderTop="thick solid #0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change top border" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderTop - ıϱ߿Ŀȡʽɫ718ö߿ɫ                        ɫɫö߿ɫ



÷
borderTopColor Ԫϱ߿ɫ
﷨
Object.style.borderTopColor=color-name|color-RGB|color-hex
ʵ
ıϱ߿ɫ
<html>
<head>
<style type="text/css">
p
{ 
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderColor()
{
document.getElementById("p1").style.borderTopColor="#0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderColor()" 
value="Change paragraph border color" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderTopColor - ıϱ߿ɫ718ö߿ʽ                        ʽʽö߿ʽ



÷
borderTopStyle Ԫصϱ߿ʽ
﷨
Object.style.borderTopStyle=style
ֵܵ
ֵ	
none	ޱ߿
hidden	 "none" ͬӦڱʱ⣬ڱhidden ڽ߿ͻ
dotted	״߿ڴгΪʵߡ
dashed	ߡڴгΪʵߡ
solid	ʵߡ
double	˫ߡ˫ߵĿȵ border-width ֵ
groove	 3D ۱߿Чȡ border-color ֵ
ridge	 3D ¢״߿Чȡ border-color ֵ
inset	 3D inset ߿Чȡ border-color ֵ
outset	 3D outset ߿Чȡ border-color ֵ
ʵ
Ķϱ߿ʽ
<html>
<head>
<style type="text/css">
p
{
border: thick solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorder()
{
document.getElementById("p1").style.borderTopStyle="dotted";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorder()"
value="Change border style" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderTopStyle - ıϱ߿ʽ718ö߿Ŀ                        ö߿Ŀ



÷
borderTopWidth Ԫصϱ߿Ŀȡ
﷨
Object.style.borderTopWidth=thin|medium|thick|length
ֵܵ
ֵ	
thin	ϸ±߿
medium	Ĭϡеȵ±߿
thick	ֵ±߿
length	Զ±߿Ŀȡ
ʵ
Ӹıϱ߿Ŀȣ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderWidth()
{
document.getElementById("p1").style.borderTopWidth="thick";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderWidth()"
value="Change border width" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderTopWidth - ıϱ߿Ŀȡ718߿Ŀ                  ߿ȡ߿ȡ߿Ŀ (ֿ)


÷
borderWidth ĸ߿Ŀȡ
Կʹ 1  4 ֵ
涨һֵ div {border-width: thick} - ĸ߿Ǵߡ
涨ֵ div {border-width: thick thin} - ±߿Ǵߣұ߿ϸߡ
涨ֵ div {border-width: thick thin medium}- ϱ߿Ǵߣұ߿ϸߣ±߿е (medium) Ŀȡ
涨ĸֵ div {border-width: thick thin medium 10px} - ϱ߿Ǵߣұ߿ϸߣ±߿еȵĿȣ߿ 10px Ŀȡ
﷨
Object.style.borderWidth=thin|medium|thick|length
ֵܵ
ֵ	
thin	ϸ±߿
medium	Ĭϡеȵ±߿
thick	ֵ±߿
length	Զ±߿Ŀȡ
ʵ
ı߿Ŀȣ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #FF0000
}
</style>
<script type="text/javascript">
function changeBorderWidth()
{
document.getElementById("p1").style.borderWidth="thick thin";
}
</script>
</head>
<body>

<input type="button" onclick="changeBorderWidth()"
value="Change border widths" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
borderWidth - ıĸ߿Ŀȡ718Ԫصı߾                          ߾߾Ԫصı߾ (ĸֵ)



÷
margin Ԫص߾ࡣ
Կʹ 1  4 ֵ
涨һֵ div {margin: 50px} - е߾඼ 50 px
涨ֵ div {margin: 50px 10px} - ߾ 50px߾ 10 px
涨ֵ div {margin: 50px 10px 20px}- ߾ 50 px߾ 10 px߾ 20 px
涨ĸֵ div {margin: 50px 10px 20px 30px} - ߾ 50 px߾ 10 px߾ 20 px߾ 30 px
﷨
Object.style.margin=margin
ֵܵ
ֵ	
margin	
߾ࡣ
ֵǣ
ٷֱȣڸܸ߶Ȼȵİٷֱȣ
ֵһ̶ı߾ࣩ
auto趨ֵ
ʵ
Ӹı˶߾ࣺ
<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.margin="100px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()"
value="Change margins of a paragraph" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
margin - ı߾718Ԫصĵױ߾                        ױ߾ױ߾Ԫصĵױ߾



÷
marginBottom Ԫص߾ࡣ
﷨
Object.style.marginBottom=auto|length|%
ֵܵ
ֵ	
auto	õһ߾ࡣ
length	һ̶߾ࡣĬֵ 0
%	ڸܸ߶ȵİٷֱ߾ࡣ
ʵ
ı߾ࣺ
<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.marginBottom="32px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()" 
value="Change the bottom margin of a paragraph" />

<p>This is a paragraph</p>
<p id="p1">This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>
TIY
marginBottom - ıԪص߾718Ԫص߾                        ߾߾Ԫص߾




÷
marginLeft Ԫص߾ࡣ
﷨
Object.style.marginLeft=auto|length|%
ֵܵ
ֵ	
auto	õ߾ࡣ
length	̶߾ࡣĬֵ0
%	ڸܸ߶ȵİٷֱ߾ࡣ
ʵ
˶߾ࣺ
<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.marginLeft="32px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()" 
value="Change the left margin of a paragraph" />

<p>This is a paragraph</p>
<p id="p1">This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>
TIY
marginLeft - ıԪص߾718Ԫصұ߾                        ұ߾ұ߾Ԫصұ߾



÷
marginRight Ԫص߾ࡣ
﷨
Object.style.marginRight=auto|length|%
ֵܵ
ֵ	
auto	õұ߾ࡣ
length	̶ұ߾ࡣĬֵ 0
%	ڸܸ߶ȵİٷֱұ߾ࡣ
ʵ
Ӹı˶߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
text-align: right
}
</style>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.marginRight="32px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()"
value="Change the right margin of a paragraph" />

<p>This is a paragraph</p>
<p id="p1">This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>
TIY
marginRight - ı߾718ԪصĶ߾                        ߾߾ԪصĶ߾



÷
marginTop Ԫص߾ࡣ
﷨
Object.style.marginTop=auto|length|%
ֵܵ
ֵ	
auto	õ߾ࡣ
length	̶߾ࡣĬֵ 0
%	ڸܸ߶ȵİٷֱ߾ࡣ
ʵ
ı߾ࣺ
<html>
<head>
<script type="text/javascript">
function changeMargin()
{
document.getElementById("p1").style.marginTop="32px";
}
</script>
</head>
<body>

<input type="button" onclick="changeMargin()" 
value="Change the top margin of a paragraph" />

<p>This is a paragraph</p>
<p id="p1">This is a paragraph</p>
<p>This is a paragraph</p>

</body>
</html>
TIY
marginTop - ı߾718һеoutline             һеoutline



÷
outline һԡ
﷨
Object.style.outline = outlineWidth outlineStyle outlineColor
ֵܵ
ֵ		ֵ
outlineWidth	Ŀȡ	
thin
medium
thick
length
outlineStyle	ʽ	
none
hidden
dotted
dashed
solid
double
groove
ridge
inset
outset
outlineColor	ɫ	
color-name
color-rgb
color-hex
transparent
ʵ
ӸıΧ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #00FF00;
outline: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeOutline()
{
document.getElementById("p1").style.outline="thin dotted #0000FF";
}
</script>
</head>
<body>

<input type="button" onclick="changeOutline()"
value="Change outline" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
outline - ıԪΧڷ IE 718ΧԪصɫ                  ɫɫΧԪصɫ



÷
outlineColor ԪΧɫ
﷨
Object.style.outlineColor=color-name|color-rgb|color-hex
ʵ
ıɫ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #00FF00;
outline: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeOutlineColor()
{
document.getElementById("p1").style.outlineColor="#00FF00";
}
</script>
</head>
<body>

<input type="button" onclick="changeOutlineColor()"
value="Change outline color" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
outlineColor - ıΧԪصɫڷ IE 718ΧԪصʽ                  ʽʽΧԪصʽ



÷
outlineStyle ΧԪصʽ
﷨
Object.style.outlineStyle=style
ֵܵ
ֵ	
none	Ĭϡ
dotted	һ״
dashed	һ
solid	һʵ
double	һ˫˫ߵĿȵͬ outline-width ֵ
groove	һ 3D Чȡ outline-color ֵ
ridge	һ 3D ͹Чȡ outline-color ֵ
inset	һ 3D Чȡ outline-color ֵ
outset	һ 3D ͹Чȡ outline-color ֵ
ʵ
Ӹıʽ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #00FF00;
outline: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeOutline()
{
document.getElementById("p1").style.outlineStyle="dotted";
}
</script>
</head>
<body>

<input type="button" onclick="changeOutline()"
value="Change outline style" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
outlineStyle - ıΧԪصʽڷ IE 718ΧԪص                  ȡȡΧԪص



÷
outlineWidth ΧԪصĿȡ
﷨
Object.style.outlineWidth=thin|medium|thick|length
ֵܵ
ֵ	
thin	ϸ
medium	Ĭϡеȵ
thick	ֵ
length	ϸֵ
ʵ
ıĿȣ
<html>
<head>
<style type="text/css">
p
{
border: thin solid #00FF00;
outline: thick solid #FF0000;
}
</style>
<script type="text/javascript">
function changeOutlineWidth()
{
document.getElementById("p1").style.outlineWidth="thin";
}
</script>
</head>
<body>

<input type="button" onclick="changeOutlineWidth()"
value="Change outline width" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
outlineWidth - ıΧԪصĿȣڷ IE 718Ԫصڱ߾                    Ԫص (ĸֵ)


÷
padding Ԫصڱ߾ࡣ
padding ԶԪر߿Ԫ֮Ŀռ䡣
Կɲȡ 4 ֵ
涨һֵ div {padding: 50px} - ĸߵ padding  50 px
涨ֵ div {padding: 50px 10px} - ڱ߾ 50 pxڱ߾ 10 px
涨ֵ div {padding: 50px 10px 20px} - ڱ߾ 50 pxڱ߾ 10 pxڱ߾ 20 px
涨ĸֵ div {padding: 50px 10px 20px 30px} - ڱ߾ 50 pxڱ߾ 10 pxڱ߾ 20 pxڱ߾ 30 px
﷨
Object.style.padding=padding
Possible Values
ֵ	
padding	
ڱ߾ࡣ
ֵǣ
ٷֱȣڸܸ߶Ȼȵİٷֱȣ
ֵһ̶ı߾ࣩ
auto趨ֵ
ʵ
ıԪصڱ߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.padding="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change padding" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
padding - ıԪصڱ߾718Ԫص                        Ԫص



÷
paddingBottom Ԫصڱ߾ࡣ
padding ԶԪر߿Ԫ֮Ŀռ䡣
﷨
Object.style.paddingBottom=length|%
ֵܵ
ֵ	
length	̶ڱ߾ֵĬֵ 0
%	ڸԪظ߶ȵİٷֱڱ߾ࡣֵԤڵеС
ʵ
ӸıԪصڱ߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.paddingBottom="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change bottom padding" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
paddingBottom - ıԪصڱ߾718Ԫص                        Ԫص



÷
paddingLeft Ԫصڱ߾ࡣ
padding ԶԪر߿Ԫ֮Ŀռ䡣
﷨
Object.style.paddingLeft=length|%
ֵܵ
ֵ	
length	̶ڱ߾ֵĬֵ 0
%	ڸԪظ߶ȵİٷֱڱ߾ࡣֵԤڵеС
ʵ
ıԪصڱ߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.paddingLeft="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change left padding" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
paddingLeft - ıԪصڱ߾718Ԫص                        Ԫص



÷
paddingRight Ԫصڱ߾ࡣ
padding ԶԪر߿Ԫ֮Ŀռ䡣
﷨
Object.style.paddingRight=auto|length|%
ֵܵ
ֵ	
length	̶ڱ߾ֵĬֵ 0
%	ڸԪظ߶ȵİٷֱڱ߾ࡣֵԤڵеС
ʵ
ıԪصڱ߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.paddingRight="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change right padding" />

<p id="p1">This is a paragraph. This is a paragraph.
This is a paragraph. This is a paragraph.
This is a paragraph. This is a paragraph.</p>

</body>
</html>
TIY
paddingRight - ıԪصڱ߾718ԪصĶ                        ԪصĶ



÷
padding Ԫصڱ߾ࡣ
padding ԶԪر߿Ԫ֮Ŀռ䡣
﷨
Object.style.paddingTop=length|%
ֵܵ
ֵ	
length	̶ڱ߾ֵĬֵ 0
%	ڸԪظ߶ȵİٷֱڱ߾ࡣֵԤڵеС
ʵ
ıԪصڱ߾ࣺ
<html>
<head>
<style type="text/css">
p
{ 
border: thin dotted #FF0000;
}
</style>
<script type="text/javascript">
function changePadding()
{
document.getElementById("p1").style.paddingTop="2cm";
}
</script>
</head>
<body>

<input type="button" onclick="changePadding()"
value="Change top padding" />

<p id="p1">This is a paragraph</p>

</body>
</html>
TIY
paddingTop - ıԪصڱ߾718Ԫصı߲ĸԪ    ųųԪصı߲ĸԪ



÷
clear һԪصĲǷĸԪء
﷨
Object.style.clear=left|right|both|none
ֵܵ
ֵ	
left	಻Ԫ
right	Ҳ಻Ԫ
both	Ԫ
none	ĬϡԪسࡣ
ʵ
ıߵĸԪأ
<html>
<head>
<style type="text/css">
img 
{
float:left;
}
</style>
<script type="text/javascript">
function clearLeft()
{
document.getElementById("p1").style.clear="left";
}
</script>
</head>
<body>

<img src="logocss.gif" width="95" height="84" />

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="clearLeft()"
value="Clear left side of text" />

</body>
</html>
TIY
ıߵĸԪء718Ԫص״                          üüԪص״



÷
clip Ԫص״
ͼڵԪʱᷢʲô"clip" 涨ԪصĿɼߴ磬ԼԪرüʾ״
﷨
Object.style.clip=rect(top,right,bottom,left)|auto
ֵܵ
ֵ	
rect(top,right,bottom,left)	Ԫص״
auto	Ԫص״
ʾע
עͣԲ "overflow" Ϊ "visible" Ԫء
ʵ
ͼüΪָ״
<html>
<head>
<style type="text/css">
img
{
position:absolute;
top:100px;
}
</style>
<script type="text/javascript">
function clipImage()
{
document.getElementById("img1").style.clip="rect(0px,50px,50px,0px)";
}
</script>
</head>
<body>

<img id="img1" border="0" src="logocss.gif" width="95" height="84" />

<input type="button" onclick=clipImage() value="Clip image" />

</body>
</html>
TIY
ͼüΪָ״718ԪϢ                              ԪϢԪϢԪϢ



÷
content ıͼ֣һԪеʲôط
﷨
Object.style.content=value
ֵܵ
ֵ	
string	ıݡ
url	 url
counter(name)
counter(name, list-style-type)
counters(name, string)
counters(name, string, list-style-type)
 
attr(X)	ʾڸѡ֮ǰ֮ѡԡ
open-quote	 
close-quote	 
no-open-quote	 
no-close-quote	 
ʾע
עͣһжڸԪضԿռ̫٣ԪػһУ̻㹻ռһΪֹ
עͣԪصݡͱ߿ӦóڸԪ֮ǰ鼶Ԫصıͱ߿ӦڸԪ֮󣬵ǿ鼶ԪصӦڸԪصǰ档
ʵ
ͼ񸡶ߣ
<html>
<head>
<script type="text/javascript">
function setFloatLeft()
{
document.getElementById("img1").style.cssFloat="left";
}
</script>

</head>
<body>

<img id="img1" src="logocss.gif" width="95" height="84" />

<p>This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<form>
<input type="button" onclick="setFloatLeft()" value="Set image to float left" />
</form>

</body>
</html>
TIY
ͼ񸡶ֵߡ718ļƵб        ļƵбָʾÿԪسʱĬ1718ļƵб        ֵֵļƵбָʾÿԪسʱõֵĬ0718ͼı()һԪصĺδ    ͼı֣һԪеĺδ



÷
ıͼ֣һԪеʲôط
﷨
Object.style.cssFloat=left|right|none
ֵܵ
ֵ	
left	ͼıڸԪصߡ
right	ͼıڸԪصұߡ
none	ͼıʾڸԪгֵλá
ʾע
עͣһжڸԪضԿռ̫٣ԪػһУ̻㹻ռһΪֹ
ʵ
ͼ񸡶ߣ
<html>
<head>
<script type="text/javascript">
function setFloat()
{
document.getElementById("img1").style.cssFloat="left";
}
</script>
</head>
<body>

<img id="img1" src="logocss.gif" />

<p>This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="setFloat()"
value="Set image to float to the left" />

</body>
</html>
TIY
cssFloat - ͼ񸡶ֵߣڷ IE в鿴718ʾָ                      ʽʽʾָ



÷
cursor Թ涨ʾָ루꣩͡
﷨
Object.style.cursor=cursortype
ֵܵ
ֵ	
url	
豻ʹõԶURL
עͣڴбĩʼնһͨĹ꣬Էû URL Ŀùꡣ
default	ĬϹ꣨ͨһͷ
auto	ĬϡõĹꡣ
crosshair	Ϊʮߡ
pointer	Ϊָʾӵָ루һֻ֣
move	˹ָʾĳɱƶ
e-resize	˹ָʾοıԵɱңƶ
ne-resize	˹ָʾοıԵɱϼƶ/
nw-resize	˹ָʾοıԵɱϼƶ/
n-resize	˹ָʾοıԵɱϣƶ
se-resize	˹ָʾοıԵɱ¼ƶ/
sw-resize	˹ָʾοıԵɱ¼ƶ/
s-resize	˹ָʾοıԵɱƶ/
w-resize	˹ָʾοıԵɱƶ
text	˹ָʾı
wait	˹ָʾæͨһֻɳ©
help	˹ָʾõİͨһʺŻһ򣩡
ʵ
ıָ룺
<html>
<head>
<script type="text/javascript">
function changeCursor()
{
document.body.style.cursor="crosshair";
document.getElementById("p1").style.cursor="text";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text.</p>

<input type="button" onclick="changeCursor()"
value="Change cursor" />

</body>
</html>
TIY718Ԫصı                      ַַԪصı



÷
direction Ԫصı
﷨
Object.style.direction=ltr|rtl|inherit
Possible Values
ֵ	
ltr	Ĭϡݴ
rtl	ݴ
inherit	ӸԪؼ̳С
ʵ
ıΪ
<html>
<head>
<script type="text/javascript">
function changeTextDirection()
{
document.getElementById("p1").style.direction="rtl";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="changeTextDirection()" 
value="Set text to flow right to left" />

</body>
</html>
TIY
direction - ıΪ718Ԫαʾ                      ʾʾԪαʾ



÷
display Ԫʾ
﷨
Object.style.display=value
Possible Values
ֵ	
none	Ԫزᱻʾ
block	ԪؽʾΪ鼶ԪأԪǰлз
inline	ĬϡԪػᱻʾΪԪأԪǰûлз
list-item	ԪػΪбʾ
run-in	ԪػΪ鼶ԪػԪʾ
compact	ԪػΪ鼶ԪػԪʾ
marker	
table	ԪػΪ鼶ʾ <table>ǰлз
inline-table	ԪػΪʾ <table>ǰûлз
table-row-group	ԪػΪһеķʾ <tbody>
table-header-group	ԪػΪһеķʾ <thead>
table-footer-group	ԪػΪһеķʾ <tfoot>
table-row	ԪػΪһʾ <tr>
table-column-group	ԪػΪһеķʾ <colgroup>
table-column	ԪػΪһԪʾ <col>
table-cell	ԪػΪһԪʾ <td>  <th>
table-caption	ԪػΪһʾ <caption>
ʵ
òʾԪأ
<html>
<head>
<script type="text/javascript">
function removeElement()
{
document.getElementById("p1").style.display="none";
}
</script>
</head>
<body>

<h1>Hello</h1>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="removeElement()"
value="Do not display paragraph" />

</body>
</html>
TIY
display - òʾԪء718Ԫصĸ߶                          ȫߡȫߡԪصĸ߶



÷
height Ԫصĸ߶ȡ
﷨
Object.style.height=auto|length|%
ֵܵ
ֵ	
auto	Ĭϡʵʵĸ߶ȡ
length	ʹ pxcm ȵλ߶ȡ
%	İٷֱȸ߶ȡ
ʵ
ðťĸ߶ȣ
<html>
<head>
<script type="text/javascript">
function setHeight()
{
document.getElementById("b1").style.height="50px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setHeight()"
value="Change height of button to 50 px" />

</body>
</html>
TIY
height - Ԫصĸ߶ȡ718principalboxı߿Եľmarker boxprincipal boxı߿Եľ718Ƿcross markscrop marksӦpage boxԵ֮Ƿ֮Ƿ֮Ƿcross markscrop marksӦpage boxԵ֮718Ԫص߶                      ߶ȡ߶ȡԪص߶



÷
maxHeight Ԫص߶ȡ
﷨
Object.style.maxHeight=length|%
ֵܵ
ֵ	
length	Ԫص߶ֵ
%	İٷֱ߶ȡ
ʵ
Ԫؿ߶ȣ
<html>
<head>
<script type="text/javascript">
function setMaxHeight()
{
document.getElementById("p1").style.maxHeight="10px";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="setMaxHeight()"
value="Set max height" />

</body>
</html>
TIY
maxHeight - Ԫؿ߶ȡ718Ԫص                      ȡȡԪص



÷
maxWidth Ԫصȡ
﷨
Object.style.maxWidth=length|%
ֵܵ
ֵ	
length	Ԫصֵ
%	İٷֱȡ
ʵ
Ԫؿȣ
<html>
<head>
<script type="text/javascript">
function setMaxWidth()
{
document.getElementById("p1").style.maxWidth="10px";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="setMaxWidth()"
value="Set max width" />

</body>
</html>
TIY
maxWidth - Ԫؿȡ718ԪصС߶                      С߶ȡС߶ȡԪصС߶



÷
minHeight ԪصС߶ȡ
﷨
Object.style.minHeight=length|%
ֵܵ
ֵ	
length	ԪصС߶ֵ
%	İٷֱС߶ȡ
ʵ
ԪؿС߶ȣ
<html>
<head>
<script type="text/javascript">
function setMinHeight()
{
document.getElementById("p1").style.minHeight="200px";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="setMinHeight()"
value="Set min height" />

</body>
</html>
TIY
minHeight - ԪؿС߶ȡ718ԪصС                      СȡСȡԪصС



÷
minWidth ԪؿСȡ
﷨
Object.style.minWidth=length|%
ֵܵ
ֵ	
length	ԪصСֵ
%	İٷֱСȡ
ʵ
ԪؿСȣ
<html>
<head>
<script type="text/javascript">
function setMinWidth()
{
document.getElementById("p1").style.minWidth="1000px";
}
</script>
</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<input type="button" onclick="setMinWidth()" value="Set min width" />

</body>
</html>
TIY
minWidth - ԪؿСȡ718涨δʺԪغе          涨δʺԪغе



÷
overflow Թ涨δδԪؿݡ
﷨
Object.style.overflow=visible|hidden|scroll|auto
ֵܵ
ֵ	
visible	ݲᱻ޼Ԫؿ֮⡣
hidden	ݻᱻ޼ʾ鿴ݵĹ
scroll	ݻᱻ޼ʾԱ鿴ݡ
auto	ʾҪʾ
ʵ
ʹ overflow ʾԪؿݣ
<html>
<head>
<style type="text/css">
div
{
border:thin solid green;
width:100px;
height:100px;
}
</style>
<script type="text/javascript">
function hideOverflow()
{
document.getElementById("div1").style.overflow="hidden";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="hideOverflow()"
value="Hide overflow" />

</body>
</html>
TIY
overflow - 718öԪеݽдֱ          ֱֱöԪеݽдֱ



÷
verticalAlign ԪؿеĴֱ뷽ʽ
﷨
Object.style.verticalAlign=value
ֵܵ
ֵ	
baseline	ĬϡԪطڸԪصĻϡ
sub	ֱı±ꡣ
super	ֱıϱ
top	ԪصĶԪصĶ˶
text-top	ԪصĶ븸ԪĶ˶
middle	ѴԪطڸԪصв
bottom	ԪصĶ͵ԪصĶ˶롣
text-bottom	Ԫصĵ׶븸Ԫĵ׶˶롣
length	 
%	ʹ "line-height" ԵİٷֱֵдԪءʹøֵ
ʵ
ñıĴֱ뷽ʽ
<html>
<head>
<script type="text/javascript">
function alignText()
{
document.getElementById("td1").style.verticalAlign="bottom";
}
</script>
</head>
<body>

<table border="1" height="100px">
  <tr>
    <td id="td1">
    Some example text
    </td> 
  </tr>
</table>
<br />
<input type="button" onclick="alignText()"
value="Align text" />

</body>
</html>
TIY
verticalAlign - ֱеı718ԪǷɼ                        ɼʽɼʽԪǷɼ




÷
visibility ԪǷɼ
﷨
Object.style.visibility=visible|hidden|collapse
ֵܵ
ֵ	
visible	ĬϡԪؿǿɼġ
hidden	Ԫؿ򲻿ɼȻӰ첼֡
collapse	ڱԪʹʱֵɾһлһУӰĲ֡лռݵĿռʹáֵԪϣΪ "hidden"
ʵ
һı
<html>
<head>
<script type="text/javascript">
function changeVisibility()
{
document.getElementById("p1").style.visibility="hidden";
}
</script>

</head>
<body>

<p id="p1">This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.</p>

<form>
<input type="button" onclick="changeVisibility()"
value="Hide paragraph" />
</form>

</body>
</html>
TIY
visibility - һı718ԪصĿ                          ȫȫԪصĿ




÷
width ԪصĿȡ
﷨
Object.style.width=auto|length|%
ֵܵ
ֵ	
auto	ĬϡɼʵʵĿȡ
%	İٷֱȿȡ
length	ʹ pxcm ȵλȡ
ʵ
ðťĿȣ
<html>
<head>
<script type="text/javascript">
function setWidth()
{
document.getElementById("b1").style.width="300px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setWidth()"
value="Change width to 300 px" />

</body>
</html>
TIY
width - ԪصĿȡ718һб                бԡбԡһб




÷
listStyle һбԡ
﷨
Object.style.listStyle=listStyleType listStylePosition listStyleImage
Possible Values
ֵ		ֵ
listStyleType	
б־͡
עͣеֵжЧ
none
disc
circle
square
decimal
decimal-leading-zero
lower-roman
upper-roman
lower-alpha
upper-alpha
lower-greek
lower-latin
upper-latin
hebrew
armenian
georgian
cjk-ideographic
hiragana
katakana
hiragana-iroha
katakana-iroha
listStylePosition	б־жλ	
outside
inside
listStyleImage	ͼΪб־	
none
url(url)
ʵ
ıбͣ
<html>
<head>
<script type="text/javascript">
function changeList()
  {
  document.getElementById("ul1").style.listStyle="decimal inside";
  }
</script>
</head>
<body>

<ul id="ul1">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>

<input type="button" onclick="changeList()"
value="Change list style" />

</body>
</html>
TIY
listStyle - ıб͡718ͼΪб                  ͼǡͼǡͼΪб



÷
listStyleImage ԰ͼΪб־
﷨
Object.style.listStyleImage=url|none
ֵܵ
ֵ	
url	ͼε·
none	ʾͼ
ʵ
Ӹıбб־
<html>
<head>
<script type="text/javascript">
function changeList()
{
document.getElementById("ul1").style.listStyleImage="url('blueb.gif')";
}
</script>
</head>
<body>

<ul id="ul1">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>

<input type="button" onclick="changeList()"
value="Change list-item marker" />

</body>
</html>
TIY
listStyleImage - ıбб־718ıбǵλ                    ǡǡıбǵλ



÷
listStylePosition Զбебǽжλ
﷨
Object.style.listStylePosition=inside|outside
ֵܵ
ֵ	
inside	бĿǷıڣһıݱǶ롣
outside	ĬϡֱλıࡣбĿǷı⣬һıݱǶ롣
ʵ
ıб־λã
<html>
<head>
<script type="text/javascript">
function changeList()
{
document.getElementById("ul1").style.listStylePosition="inside";
}
</script>
</head>
<body>

<ul id="ul1">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>

<input type="button" onclick="changeList()"
value="Change list-item marker position" />

</body>
</html>
TIY
listStylePosition - ıб־λá718бǵ                    ͡͡бǵ



÷
listStyleType б־͡
﷨
Object.style.listStyleType=value
ֵܵ
CSS2 ֵ
ֵ	
none	ޱǡ
disc	ĬϡʵԲ
circle	ǿԲ
square	ʵķ顣
decimal	֡
decimal-leading-zero	0ͷֱǡ(01, 02, 03, ȡ)
lower-roman	Сд(i, ii, iii, iv, v, ȡ)
upper-roman	д(I, II, III, IV, V, ȡ)
lower-alpha	СдӢĸThe marker is lower-alpha (a, b, c, d, e, ȡ)
upper-alpha	дӢĸThe marker is upper-alpha (A, B, C, D, E, ȡ)
lower-greek	Сдϣĸ(alpha, beta, gamma, ȡ)
lower-latin	Сдĸ(a, b, c, d, e, ȡ)
upper-latin	дĸ(A, B, C, D, E, ȡ)
hebrew	ͳϣŷʽ
armenian	ͳǱŷʽ
georgian	ͳǱŷʽ(an, ban, gan, ȡ)
cjk-ideographic	򵥵ı
hiragana	ǣa, i, u, e, o, ka, ki, ȡƬ
katakana	ǣA, I, U, E, O, KA, KI, ȡƬ
hiragana-iroha	ǣi, ro, ha, ni, ho, he, to, ȡƬ
katakana-iroha	ǣI, RO, HA, NI, HO, HE, TO, ȡƬ
CSS2.1 ֵ
disc | circle | square | decimal | decimal-leading-zero | 
lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | 
armenian | georgian | none | inherit
ʵ
ıбͣ
<html>
<head>
<script type="text/javascript">
function changeList()
{
document.getElementById("ul1").style.listStyleType="square";
}
</script>
</head>
<body>

<ul id="ul1">
  <li>Coffee</li>
  <li>Tea</li>
  <li>Water</li>
  <li>Soda</li>
</ul>

<input type="button" onclick="changeList()"
value="Change list-item marker type" />

</body>
</html>
TIY
listStyleType - ıб͡718ԪصĵױԵ븸ԪصױԵ    ׾׾ԪصĵױԵ븸ԪصױԵ֮ϻ֮µľ



÷
bottom öλԪ߾߽±߽֮ƫơ
﷨
Object.style.bottom=auto|%|length
ֵܵ
ֵ	
auto	Ĭϡͨײλá
%	ԪصĵױߵһжλøԪصĵײԵİٷֱλá
length	ʹ pxcm ȵλԪصĵױߵһжλøԪصĵײԵλáʹøֵ
ʾע
Note: "position" ԵֵΪ "static"ô "bottom" ԲκЧ
ʵ
Ԫص±߽ã
<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setBottomEdge()
{
document.getElementById("b1").style.bottom="100px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setBottomEdge()"
value="Set bottom edge to 100 px" />

</body>
</html>
TIY
bottom - Ԫص±߽á718ԪصԵ븸ԪԵ      ԪصԵ븸ԪԵ߻ұߵľ



÷
left öλԪ߾߽߽֮ƫơ
﷨
Object.style.left=auto|%|length
ֵܵ
ֵ	
auto	Ĭϡͨλá
%	ԪصߵһжλøԪصԵİٷֱλá
length	ʹ pxcm ȵλԪصߵһжλøԪصԵλáʹøֵ
ʾע
עͣ "position" ԵֵΪ "static"ô "left" ԲκЧ
ʵ
Ӷ԰ť߽ã
<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setLeftEdge()
{
document.getElementById("b1").style.left="100px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setLeftEdge()"
value="Set left edge to 100 px" />

</body>
</html>
TIY
left - Ԫص߽á718Ԫضλͻ˵ʽ                λ͡λ͡Ԫطstatic, relative, absolute  fixed λ



÷
position ԰Ԫطõһ̬ġԵġԵġ̶λС
﷨
Object.style.position=static|relative|absolute|fixed
ֵܵ
ֵ	
static	ĬϡλΪ static Ԫأʼջᴦҳλãstatic Ԫػκ topbottomleft  right 
relative	λñΪ relative Ԫأɽλõĵط "left:20" ὫԪԪλ 20 صλá
absolute	λΪ absolute ԪأɶλڰԪصָꡣԪصλÿͨ "left""top""right" Լ "bottom" 涨
fixed	λñΪ fixed ԪأɶλڵָꡣԪصλÿͨ "left""top""right" Լ"bottom" 涨۴ڹԪضǸλá IE7strict ģʽ
ʵ
ԪλԸΪԣ
<html>
<head>
<style type="text/css">
input
{
position:relative;
}
</style>
<script type="text/javascript">
function setPositionAbsolute()
{
document.getElementById("b1").style.position="absolute";
document.getElementById("b1").style.top="10px";
}
</script>
</head>
<body>

<p>This is an example paragraph</p>
<p>This is an example paragraph</p>

<input type="button" id="b1" onclick="setPositionAbsolute()"
value="Set button position to be absolute" />

</body>
</html>
TIY
position - ıԪصλá718ԪصұԵ븸ԪұԵ      ҾҾԪصұԵ븸ԪұԵ߻ұߵľ





÷
right öλԪ߾߽ұ߽֮ƫơ
﷨
Object.style.right=auto|%|length
ֵܵ
ֵ	
auto	ĬϡͨҲλá
%	ԪصұߵһжλøԪصұԵİٷֱλá
length	ʹ pxcm ȵλԪصұߵһжλøԪصұԵλáʹøֵ
ʾע
עͣ "position" ԵֵΪ "static"ô "right" ԲκЧ
ʵ
԰ť߽ã
<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setRightEdge()
{
document.getElementById("b1").style.right="100px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setRightEdge()"
value="Set right edge to 100 px" />

</body>
</html>
TIY
right - Ԫصұ߽718ԪصĶԵ븸ԪضԵ    ԪصĶԵ븸ԪضԵ֮ϻ֮µľ



÷
top һλԪص߾߽ϱ߽֮ƫơ
﷨
Object.style.top=auto|%|length
ֵܵ
ֵ	
auto	Ĭϡͨ㶥λá
%	ԪصĶһжλøԪصϱԵİٷֱλá
length	ʹ pxcm ȵλԪصĶһжλϱԵĶλáʹøֵ
ʾע
עͣ "position" ԵֵΪ "static"ô "top" ԲκЧ
ʵ
Ԫصϱ߽磺
<html>
<head>
<style type="text/css">
input
{
position:absolute;
}
</style>
<script type="text/javascript">
function setTopEdge()
{
document.getElementById("b1").style.top="100px";
}
</script>
</head>
<body>

<input type="button" id="b1" onclick="setTopEdge()"
value="Set top edge to 100 px" />

</body>
</html>
TIY
top - Ԫصϱ߽718ԪصĶѵ                      ѵѵԪصĶѵ


÷
zIndex ԪصĶѵ˳
һλԪ z λãz ᶨΪֱ쵽ʾᡣΪûΪʾûԶ
﷨
Object.style.zIndex=auto|number
ֵܵ
ֵ	
auto	Ĭϡѵ˳븸Ԫȡ
number	ԪصĶѵ˳
ʾע
עͣԪؿӵи z-index ֵ
עͣZ-index ڶλԪЧ position:absolute;
ʵ
ıԪصĶѵ˳
<html>
<head>
<style type="text/css">
#img1
{
position:absolute;
left:0px;
top:0px;
z-index:-1
}
</style>
<script type="text/javascript">
function changeStackOrder()
{
document.getElementById("img1").style.zIndex="1";
}
</script>
</head>
<body>

<h1>This is a Heading</h1>

<img id="img1" src="bulbon.gif" width="100" height="180">

<p>Default z-index is 0. Z-index -1 has lower priority.</p>

<input type="button" onclick="changeStackOrder()"
value="Change stack order" />

</body>
</html>
TIY
zIndex - ıԪصĶѵ˳718öҳײС          ССöҳײС718ʾĳԪʱʹõҳ          ҳ͡ҳ͡ʾĳԪʱʹõҳ͡718ĳԪ֮ķҳΪ                ҳΪҳΪĳԪ֮ķҳΪ


÷
pageBreakAfter ԪغӦ÷ҳ
﷨
Object.style.pageBreakAfter=auto|always|avoid|left|right
ֵܵ
ֵ	
auto	ĬϡҪԪغҳ
always	Ԫغҳ
avoid	Ԫغҳ
left	Ԫ֮㹻ķҳһֱһſհ׵ҳΪֹ
right	Ԫ֮㹻ķҳһֱһſհ׵ҳΪֹ
ʵ
 id Ϊ p1 Ķ֮һ page-break
<html>
<head>
<script type="text/javascript">
function setPageBreak()
{
document.getElementById("p1").style.pageBreakAfter="always";
}
</script>
</head>
<body>

<p id="p1">This is a test paragraph.</p>

<input type="button" onclick="setPageBreak()"
value="Set page-break" />

<p>This is also a test paragraph.</p>

</body>
</html>718ĳԪ֮ǰķҳΪ                ǰҳǰҳĳԪ֮ǰķҳΪ



÷
pageBreakBefore һԪǰǷӦ÷ҳ
﷨
Object.style.pageBreakBefore=auto|always|avoid|left|right
ֵܵ
ֵ	
auto	ĬϡҪԪǰҳ
always	Ԫǰҳ
avoid	Ԫǰҳ
left	Ԫ֮ǰ㹻ķҳһֱһſհ׵ҳΪֹ
right	Ԫ֮ǰ㹻ķҳһֱһſհ׵ҳΪֹ
ʵ
 id Ϊ p2 Ķ֮ǰһ page-break
<html>
<head>

<script type="text/javascript">
function setPageBreak()
{
document.getElementById("p2").style.pageBreakBefore="always";
}
</script>
</head>
<body>

<p>This is a test paragraph.</p>

<input type="button" onclick="setPageBreak()"
value="Set page-break" />

<p id="p2">This is also a test paragraph.</p>

</body>
</html>718ĳԪڲķҳΪ                ڷҳڷҳĳԪڲķҳΪ



÷
pageBreakInside һԪڲǷӦ÷ҳ
﷨
Object.style.pageBreakInside=auto|avoid
ֵܵ
ֵ	
auto	ĬϡҪԪڲҳ
avoid	Ԫڲҳ
ʵ
 id Ϊ p2 Ķе page-break
<html>
<head>
<script type="text/javascript">
function setPageBreak()
{
document.getElementById("p2").style.pageBreakInside="avoid";
}
</script>
</head>
<body>

<p>This is a test paragraph.</p>

<input type="button" onclick="setPageBreak()"
value="Set page to not break inside the second paragraph" />

<p id="p2">This is also a test paragraph. We need some
more text here. This is just filler text.</p>

</body>
</html>718ҳķͳߴ                    ߴߴҳķͳߴ718öҳ涥С      ССöҳ涥С718ñ߿ǷϲΪ߿߷    ñ߿ǷϲΪ߿򣬻ڱ׼HTML롣



÷
borderCollapse ñı߿Ƿ񱻺ϲΪһһı߿򣬻ڱ׼ HTML ֿʾ
﷨
Object.style.borderCollapse=collapse|separate
ֵܵ
ֵ	
separate	߿ᱻֿ
collapse	Ĭϡܣ߿ᱻϲΪһһı߿
ʵ
Ӻϲ߿
<html>
<head>
<script type="text/javascript">
function setBorderCollapse()
{
document.getElementById('myTable').style.borderCollapse="collapse"
}
</script>
</head>
<body>

<table border="1" id="myTable">
  <tr>
    <td>100</td>
    <td>200</td>
  </tr>
  <tr>
    <td>300</td>
    <td>400</td>
  </tr>
</table>
<br />
<input type="button" onclick="setBorderCollapse()"
value="Collapse border">

</body>
</html>
TIY
borderCollapse - ѱ߿ϲΪһ߿718÷ָԪ߿ľ                ÷ָԪ߿ľ



÷
borderSpacing ڵԪı߿֮ľ루ڡ߿롱ģʽ
﷨
Object.style.borderSpacing=length,length
ֵܵ
ֵ	
length length	ʹ pxcm ȵλ롣һ length ôˮƽʹֱࡣ length ôһˮƽ࣬ڶôֱࡣlength Ϊֵ
ʵ
ڵԪı߿֮ľ룺
<html>
<head>
<script type="text/javascript">
function changeBorderSpacing()
{
document.getElementById('myTable').style.borderSpacing="10px"
}
</script>
</head>
<body>

<table border="1" id="myTable">
  <tr>
    <td>100</td>
    <td>200</td>
  </tr>
  <tr>
    <td>300</td>
    <td>400</td>
  </tr>
</table>

<input type="button" onclick="changeBorderSpacing()" 
value="Change border spacing">

</body>
</html>
TIY
borderSpacing - ıڵԪı߿֮ľ루ڷ IE в鿴718ñλ                      λáλáñλ


÷
captionSide ñλá
﷨
Object.style.captionSide=top|bottom|left|right
ֵܵ
ֵ	
top	Ĭϡѱⶨλڱ֮ϡ
bottom	ѱⶨλڱ֮¡
left	ѱⶨλڱߡ
right	ѱⶨλڱұߡ
ʵ
ƶ⣺
<html>
<head>
<style type="text/css">
caption
{
caption-side:bottom; 
}
</style>
<script type="text/javascript">
function moveCaption()
{
document.getElementById('myTable').style.captionSide="right"
}
</script>
</head>
<body>

<table border="1" id="myTable">
  <caption>This is a caption</caption>
  <tr>
    <td>100</td>
    <td>200</td>
  </tr>
  <tr>
    <td>300</td>
    <td>400</td>
  </tr>
</table>
<br />
<input type="button" onclick="moveCaption()"
value="Move table caption">

</body>
</html>
TIY
captionSide - Աжλڷ IE в鿴718ǷʾеĿյԪ            ո߿ո߿ǷʾеĿյԪ



÷
emptyCells ǷʾеĿյԪ񣨽ڡ߿ģʽ
﷨
Object.style.emptyCells=hide|show
ֵܵ
ֵ	
hide	ĬϡڿյԪΧƱ߿
show	ڿյԪΧƱ߿
ʵ
ıյԪʾʽ
<html>
<head>
<script type="text/javascript">
function showEmptyCells()
{
document.getElementById('myTable').style.emptyCells="show"
}
</script>
</head>
<body>

<table border="1" id="myTable">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td></td>
</tr>
</table>

<input type="button" onclick="showEmptyCells()"
value="Show empty cells">

</body>
</html>
TIY
ıյԪʾʽ718ʾԪԼе㷨  ʾԪԼе㷨



÷
tableLayout ʾԪСе㷨
̶񲼾֣
̶񲼾Զ񲼾ȣضԱв֡
ڹ̶񲼾Уˮƽֽȡڱȡпȡ߿ȡԪ࣬뵥Ԫ޹ء
ͨʹù̶񲼾֣ûڽյһкͿʾ
Զ񲼾֣
Զ񲼾УеĿеԪûе趨ġ
㷨ʱҪȷյĲ֮ǰʱеݡ
﷨
Object.style.tableLayout=automatic|fixed
ֵܵ
ֵ	
automatic	ĬϡпɵԪ趨
fixed	пɱȺп趨
ʵ
ù̶񲼾֣
<html>
<head>
<script type="text/javascript">
function setFixedTableLayout()
{
document.getElementById('myTable').style.tableLayout="fixed";
}
</script>
</head>
<body>

<table id="myTable" border="1" width="100%">
<col width="20%"><col width="40%"><col width="40%">
<tr>
<td>1000000000000000000000000000</td>
<td>10000000</td>
<td>100</td>
</tr>
</table>

<input type="button" onclick="setFixedTableLayout()"
value="Set fixed table layout">

</body>
</html>
TIY
ıĲ (tableLayout)718ıɫ                          ɫɫıɫ




÷
color ıɫԪصǰɫ
﷨
Object.style.color=color
ֵܵ
ֵ	
color	
ɫֵɫơrgb ֵʮ
Ĭֵȡ
ʵ
ııɫ
<html>
<head>
<script type="text/javascript">
function setColor()
{
document.getElementById("p1").style.color="#ff0000";
document.getElementById("p2").style.color="magenta";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph</p>
<p id="p2">This is also an example paragraph</p>

<input type="button" onclick="setColor()"
value="Change color of text" />

</body>
</html>
TIY
ııɫ718һе                һе



÷
font һԡ
﷨
Object.style.font=value
ֵܵ
ֵ	
fontStyle
fontVariant
fontWeight
fontSize/lineHeight
fontFamily
ԡ
caption	Ϊؼ壨簴ťбȣ
icon	ڱעͼ塣
menu	˵ʹõ塣
message-box	Իʹõ塣
small-caption	ڱעСͿؼ塣
status-bar	ڴ״̬ʹõ塣
ʵ
ıı壺
<html>
<head>
<script type="text/javascript">
function setFont()
{
document.getElementById("p1").style.font="italic bold 12px arial,serif";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setFont()" value="Change paragraph style" />

</body>
</html>
TIY
ıı718Ԫصϵ                      ϵСϵСԪصϵС



÷
fontFamily ԶԪıʾϵС
﷨
Object.style.fontFamily=font1,font2,....
ֵܵ
Value	Description
font1, font2,....	ƻƵбɶŷָ
ʾע
ʾʹöŷָÿֵʼṩһΪѡ
עͣкпոΪš
ʵ
ııϵУ
<html>
<head>
<script type="text/javascript">
function setFont()
{
document.getElementById("p1").style.fontFamily="arial,sans-serif";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setFont()" value="Change font" />

</body>
</html>
TIY
fontFamily - ııϵС718ԪصС                      ֵֵԪصС



÷
fontSize ԪصС
﷨
Object.style.fontSize=value
ֵܵ
ֵ	
xx-small
x-small
small
medium
large
x-large
xx-large
ĳߴΪͬĳߴ磬 xx-small  xx-large
Ĭֵmedium
smaller	 font-size ΪȸԪظСĳߴ硣
larger	 font-size ΪȸԪظĳߴ硣
length	 font-size Ϊһ̶ֵ
%	 font-size ΪڸԪصһٷֱȡ
ʵ
ııС
<html>
<head>
<script type="text/javascript">
function setFontSize()
{
document.getElementById("p1").style.fontSize="larger";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setFontSize()" 
value="Change font-size" />

</body>
</html>
TIY
fontSize - ııС718Ԫصʽ                      бȡбȡԪصʽ



÷
fontStyle ķ
﷨
Object.style.fontStyle=normal|italic|oblique
ֵܵ
ֵ	
normal	Ĭϡʾһ׼塣
italic	ʾһб塣
oblique	ʾһб塣
ʵ
ıбʽ
<html>
<head>
<script type="text/javascript">
function setFontStyle()
{
document.getElementById("p1").style.fontStyle="italic";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setFontStyle()" 
value="Change font-style" />

</body>
</html>
TIY
fontStyle - ııķ718Сʹдĸʾı            СʹдСʹдСʹдĸʾı



÷
fontVariant Сʹдĸʾı
﷨
Object.style.fontVariant=normal|small-caps
ֵܵ
ֵ	
normal	Ĭϡʾһ׼塣
small-caps	ʾСʹдĸ塣
ʵ
ѵһΪСʹдĸ
<html>
<head>
<script type="text/javascript">
function setSmallCaps()
{
document.getElementById("p1").style.fontVariant="small-caps";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>
<p>This is another example paragraph.</p>

<input type="button" onclick="setSmallCaps()" 
value="Display small-caps font" />

</body>
</html>
TIY
fontVariant - ıΪСʹдĸ718Ĵϸ                          ִϸִϸĴϸ



÷
fontWeight ַĴϸ
﷨
Object.style.fontWeight=value
ֵܵ
ֵ	
normal	Ĭϡ׼ַ
bold	ַ
bolder	ֵַ
lighter	ϸַ
100
200
300
400
500
600
700
800
900
ɴֵϸַ400 ͬ normal 700 ͬ bold
ʵ
ѵһΪ壺
<html>
<head>
<script type="text/javascript">
function setFontWeight()
{
document.getElementById("p1").style.fontWeight="900";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>
<p>This is another example paragraph.</p>

<input type="button" onclick="setFontWeight()"
value="Display bold text" />

</body>
</html>
TIY
fontWeight - ıΪ718ַ                            ַּּ



÷
letterSpacing ַ֮Ŀհס
﷨
Object.style.letterSpacing=normal|length
ֵܵ
ֵ	
normal	Ĭϡַı׼ռ䡣
length	ַĹ̶ռ䡣
ʵ
ıַ֮Ŀհף
<html>
<head>
<script type="text/javascript">
function changeLetterSpacing()
{
document.getElementById("p1").style.letterSpacing="3";
document.getElementById("p2").style.letterSpacing="-1";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>
<p id="p2">This is another example paragraph.</p>

<input type="button" onclick="changeLetterSpacing()"
value="Change letter-spacing" />

</body>
</html>
TIY
letterSpacing - ıַ֮Ŀհס718м                              ммм



÷
lineHeight ֮ľ루иߣ
﷨
Object.style.lineHeight=normal|number|length|%
ֵܵ
ֵ	
normal	Ĭϡúмࡣ
number	ֻ֣뵱ǰߴмࡣ
length	ù̶мࡣ
%	ڵǰߴİٷֱмࡣ
ʵ
ıиߣ
<html>
<head>
<script type="text/javascript">
function changeLineHeight()
{
document.getElementById("div1").style.lineHeight="2";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="changeLineHeight()"
value="Change line-height" />

</body>
</html>
TIY
lineHeight - ıиߡ718ıʹ                ͡͡ıʹ


÷
quotes Ƕõ͡
﷨
Object.style.quotes=none|string string string string
ֵܵ
ֵ	
none	涨 "content" Ե "open-quote"  "close-quote" ֵκš
string string string string	Ҫʹõšǰֵ涨һǶףֵ涨һǶס
718ı                                ııı



÷
textAlign ԶԪеı
﷨
Object.style.textAlign=left|right|center|justify
ֵܵ
ֵ	
left	ıеߡĬֵ
right	ıеұߡ
center	ıем䡣
justify	 textJustify Զı
ʵ
һı
<html>
<head>
<script type="text/javascript">
function setTextAlign()
{
document.getElementById("p1").style.textAlign="right";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setTextAlign()"
value="Align text" />

</body>
</html>
TIY
textAlign - һı718ı                          ߹ϵ߹ϵı



÷
textDecoration ԶıΡ
﷨
Object.style.textDecoration=none|underline|overline|line-through|blink
ֵܵ
ֵ	
none	Ĭϡ׼ı
underline	ıµһߡ
overline	ıϵһߡ
line-through	崩ıµһߡ
blink	˸ı޷ IE  Opera У
ʵ
ı»ߣ
<html>
<head>
<script type="text/javascript">
function setTextDecoration()
{
document.getElementById("p1").style.textDecoration="overline";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph.</p>

<input type="button" onclick="setTextDecoration()"
value="Set text-decoration" />

</body>
</html>
TIY
textDecoration - װı718еı                          еı


÷
textIndent Ԫеı
﷨
Object.style.textIndent=length|%
ֵܵ
ֵ	
length	̶Ĭֵ0
%	ڸԪؿȵİٷֱȵ
ʵ
ı
<html>
<head>
<script type="text/javascript">
function setTextIndent()
{
document.getElementById("div1").style.textIndent="50px";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="setTextIndent()"
value="Indent first line of text" />

</body>
</html>
TIY
textIndent - ı718ıôдЧ                      дáдáıôдЧ



÷
textTransform ԻıԪеĸСдԴĵıĴСд
﷨
Object.style.textTransform="none|capitalize|uppercase|lowercase|inherit"
ֵܵ
ֵ	
none	ĬϡСдĸʹдĸı׼ı
capitalize	ıеÿԴдĸͷ
uppercase	ддĸ
lowercase	޴дĸСдĸ
ʵ
ÿʵĵһĸתΪд
<html>
<head>
<script type="text/javascript">
function displayResult()
{
document.getElementById("p1").style.textTransform="capitalize";
}
</script>
</head>
<body>

<p id="p1">This is some text.</p>
<br />

<button type="button" onclick="displayResult()">Convert text</button>

</body>
</html>
һԡ718ıекͿհ׷        շáշáıекͿհ׷



÷
whiteSpace δıеĿհ׷ոͻз
﷨
Object.style.whiteSpace=normal|nowrap|pre
ֵܵ
ֵ	
normal	Ĭϡհ׻ᱻԡ
pre	հ׻ᱻΪʽ HTML е <pre> ǩ
nowrap	ıỻУıͬһϼֱ <br> ǩΪֹ
ʵ
ıڻУ
<html>
<head>
<script type="text/javascript">
function removeWrapping()
{
document.getElementById("div1").style.whiteSpace="nowrap";
}
</script>
</head>
<body>

<div id="div1">
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
This is some text. This is some text. This is some text.
</div>
<br />
<input type="button" onclick="removeWrapping()" 
value="Do not let the text wrap" />

</body>
</html>
TIY
whiteSpace - ıڻС718ıеĴʼ                      ʼʼıеĴʼ



÷
wordSpacing ıеĵʼࡣ
﷨
Object.style.wordSpacing=normal|length
ֵܵ
ֵ	
normal	Ĭϡ嵥ʼı׼ռ䡣
length	嵥ʼĹ̶ռ䡣
ʵ
ı䵥ʼļࣺ
<html>
<head>
<script type="text/javascript">
function changeWordSpacing()
{
document.getElementById("p1").style.wordSpacing="10px";
}
</script>
</head>
<body>

<p id="p1">This is an example paragraph</p>

<input type="button" onclick="changeWordSpacing()" 
value="Change space between words" />

</body>
</html>
TIY
wordSpacing - ı䵥ʼļ345Table 
Table һ HTML 
 HTML ĵ <table> ǩÿһΣһ Table ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.819ذеԪۼϣ  ذеԪһ顣



÷
cells ϷرеԪһ顣
﷨
tableObject.cells[]
ʵ
ʹ cells ʾһԪݣ
<html>
<head>
<script type="text/javascript">
function cell()
  {
  var x=document.getElementById('myTable').rows[0].cells;
  alert(x[0].innerHTML);
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>cell 1</td>
<td>cell 2</td>
</tr>
<tr>
<td>cell 3</td>
<td>cell 4</td>
</tr>
</table>
<br />
<input type="button" onclick="cell()" value="Alert first cell">

</body>
</html>
TIY
ʹ cells[] 

819ذеһۼϣ  ذеһ顣




÷
rows ϷرУTableRow 󣩵һ飬һ HTMLCollection
üϰ <thead><tfoot>  <tbody> жС
﷨
tableObject.rows[]
ʵ
ʹ rows ʾһеݣ
<html>
<head>
<script type="text/javascript">
function showRow()
  {
  alert(document.getElementById('myTable').rows[0].innerHTML)
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="showRow()" value="Show innerHTML">

</body>
</html>
TIY
ĳһе InnerHTML
ͨ rows һԪ
беĵԪ
ֱбеĵԪ
һĵԪе
ֱһĵԪе
ıԪе
һе colspan819ذtbodyۼϣ   ذ tbody һ顣819û򷵻ر߿Ŀ                û򷵻ر߿Ŀȡ



÷
border Կû򷵻ر߿ĿȣΪλ
﷨
tableObject.border=pixels
ʵ
<html>
<head>
<script type="text/javascript">
function changeBorder()
  {
  document.getElementById('myTable').border="10"
  }
</script>
</head>
<body>

<table border="1" id="myTable">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td>400</td>
</tr>
</table>
<br />
<input type="button" onclick="changeBorder()"
value="Change Border">

</body>
</html>
TIY
ıߵĿȡ819Ա <caption> Ԫص           Ա <caption> Ԫصá




÷
caption û򷵻ر caption Ԫء
<caption> Ԫضһ⡣<caption> ǩ <table> ǩ֮ÿܹ涨һ captionͨcaption λڱ֮Ͼеλá
﷨
tableObject.caption=captionObject
ʵ
ӿɷر <caption> Ԫصı
<html>
<head>
<script type="text/javascript">
function alertCaption()
  {
  alert(document.getElementById("table1").caption.innerHTML);
  }
</script>
</head>
<body>

<table id="table1" border="1">
<caption>This is a table caption</caption>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertCaption()
value="Alert table caption" />

</body>
</html>
TIY
ȡñ <caption> Ԫصı819û򷵻ظݺ͵Ԫ߿հ    û򷵻صԪݺ͵Ԫ߿֮Ŀհ



÷
cellPadding Կû򷵻صԪ߿뵥Ԫ֮ĿհΪλ
﷨
tableObject.cellPadding=pixels
ʵ
The following example changes the cell padding of a table:
<html>
<head>
<script type="text/javascript">
function padding()
  {
  document.getElementById('myTable').cellPadding="15"
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td>400</td>
</tr>
</table>
<br />
<input type="button" onclick="padding()" value="Change Cellpadding">

</body>
</html>
TIY
ı cellPadding  cellSpacing819û򷵻ڱеĵԪհ      û򷵻ڱеĵԪ֮Ŀհ



÷
cellSpacing Կû򷵻ڱеĵԪ֮ĿհΪλ
﷨
tableObject.cellSpacing=pixels
ʵ
Ӹ˱ cellSpacing
<html>
<head>
<script type="text/javascript">
function spacing()
  {
  document.getElementById('myTable').cellSpacing="15"
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td>400</td>
</tr>
</table>
<br />
<input type="button" onclick="spacing()" value="Change Cellspacing">

</body>
</html>
TIY
ı cellPadding  cellSpacing819û򷵻رⲿ߿                ߿߿û򷵻رⲿ߿



÷
frame Կû򷵻رⲿ߿
﷨
tableObject.frame=void|above|below|hsides|vsides|lhs|rhs|box|border
ʵ
˱ֲͬı߿
<html>
<head>
<script type="text/javascript">
function aboveFrames()
  {
  document.getElementById('myTable').frame="above"
  }
function belowFrames()
  {
  document.getElementById('myTable').frame="below"
  }
</script>
</head>
<body>

<table id="myTable">
<tr>
<td>100</td>
<td>200</td>
</tr>
<tr>
<td>300</td>
<td>400</td>
</tr>
</table>
<br />
<input type="button" onclick="aboveFrames()"
value="Show above frames">
<input type="button" onclick="belowFrames()"
value="Show below frames">

</body>
</html>
TIY
涨ⲿ߿819û򷵻ر id                     ididû򷵻ر id



÷
id Կû򷵻ر id
﷨
tableObject.id=id
ʵ
<html>
<head>
<script type="text/javascript">
function alertId()
  {
  alert(document.getElementById("table1").id);
  }
</script>
</head>
<body>

<table id="table1" border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertId()
value="Alert id of table" />

</body>
</html>
TIY
ʾһ id819û򷵻رڲ߿˵      ڱ߿ڱ߿û򷵻رڲ߿ߣ



÷
rules Կû򷵻رڲߡ
﷨
tableObject.rules=none|groups|rows|cols|all
ʵ
˱ֲͬڲߣ
<html>
<head>
<script type="text/javascript">
function rowRules()
  {
  document.getElementById('myTable').rules="rows"
  }
function colRules()
  {
  document.getElementById('myTable').rules="cols"
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
<tr>
<td>Row3 cell1</td>
<td>Row3 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="rowRules()"
value="Show only row borders">
<input type="button" onclick="colRules()"
value="Show only col borders">

</body>
</html>
TIY
涨ڲߡ819û򷵻ضԱ                  û򷵻ضԱ



÷
summary Կû򷵻رĸ
summary Ϊϳɻǿӵ涨˱ĸ
﷨
tableObject.summary=text
ʵ
ӿɷرĸ
<html>
<head>
<script type="text/javascript">
function alertSummary()
  {
  alert(document.getElementById("table1").summary);
  }
</script>
</head>
<body>

<table id="table1" border="1"
summary="Example table of employees">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertSummary()
value="Alert table summary" />

</body>
</html>
TIY
ȡñĸ819ر TFoot                    ššر TFoot ڸԪأΪ null819ر THead                    ͷͷر THead ڸԪأΪ null819û򷵻رĿ                    ȫȫû򷵻رĿȡ



÷
width Կû򷵻رĿȡ
﷨
tableObject.width=percent|pixels
ʵ
ӿɸıĿȣ
<html>
<head>
<script type="text/javascript">
function changeWidth()
  {
  document.getElementById("table1").width="100%";
  }
</script>
</head>
<body>

<table id="table1" border="1">
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeWidth()
value="Change table width" />
</body>
</html>
TIY
ıĿȡ819Ϊ񴴽һcaptionԪ()             Ϊ񴴽һ caption Ԫء



÷
createCaption() ڱлȡ򴴽 <caption> Ԫء
﷨
tableObject.createCaption()
ֵ
һ HTMLElement 󣬱ʾñ <caption> ԪءñѾ˱⣬򷵻ñû <caption> Ԫأ򴴽һµĿ <caption> Ԫأ񣬲
ʵ
Ϊ񴴽һ⣺
<html>
<head>
<script type="text/javascript">
function createCaption()
{
var x=document.getElementById('myTable').createCaption()
x.innerHTML="My table caption"
}
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="createCaption()"
value="Create caption">

</body>
</html>
TIY
Ϊ񴴽һ819ڱдһյtFootԪ()         ššڱдһյ tFoot Ԫء



÷
createTFoot() ڱлȡ򴴽 <tfoot> Ԫء
﷨
tableObject.createTFoot()
ֵ
һ TableSectionʾñ <tfoot> ԪءñѾ˽ע򷵻ñûнע򴴽һµĿ <tfoot> Ԫأ񣬲
ʵ
Ϊ񴴽һע
<html>
<head>
<script type="text/javascript">
function createCaption()
{
var x=document.getElementById('myTable').createTFoot()
x.innerHTML="My table foot"
}
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="createCaption()"
value="Create caption">

</body>
</html>
TIY
Ϊ񴴽һע819ڱдһյtHeadԪ()         ͷͷڱдһյ tHead Ԫء



÷
createTHead() ڱлȡ򴴽 <thead> Ԫء
﷨
tableObject.createTHead()
ֵ
һ TableSectionʾñ <thead> ԪءñѾ˱ͷ򷵻ñûбͷ򴴽һµĿ <thead> Ԫأ񣬲
ʵ
Ϊ񴴽һע
<html>
<head>
<script type="text/javascript">
function createCaption()
{
var x=document.getElementById('myTable').createTHead()
x.innerHTML="My table head"
}
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="createCaption()"
value="Create caption">

</body>
</html>
TIY
Ϊ񴴽һͷ819ӱɾcaptionԪԼ()       ɾɾӱɾ caption ԪԼݡ



÷
deleteCaption() ɾ caption Ԫؼݡ
﷨
tableObject.deleteCaption()
˵
ñ <caption> ԪأĵɾʲôҲ
ʵ
ɾı⣺
<html>
<head>
<script type="text/javascript">
function deleteCaption()
  {
  document.getElementById('myTable').deleteCaption()
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<caption>My table caption</caption>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="deleteCaption()"
value="Delete caption" />

</body>
</html>
TIY
ɾı819ӱɾһ()                        ɾСɾСӱɾһС



÷
deleteRow() ڴӱɾָλõС
﷨
tableObject.deleteRow(index)
˵
 index ָҪɾڱеλáеı˳ĵԴгֵ˳<thead>  <tfoot> еһ롣
ʵ
The following example deletes the first row of the table:
<html>
<head>
<script type="text/javascript">
function delRow()
  {
  document.getElementById('myTable').deleteRow(0)
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="delRow()"
value="Delete first row">

</body>
</html>
TIY
ӱɾС819ӱɾtFootԪؼ()           ɾšɾšӱɾ tFoot Ԫؼݡ



÷
deleteTFoot() ڴӱɾ <tfoot> Ԫء
﷨
tableObject.deleteTFoot()
˵
ñ <tfoot> ԪأĵɾʲôҲ
ʵ
ɾĽע
<html>
<head>
<script type="text/javascript">
function delRow()
  {
  document.getElementById('myTable').deleteTFoot()
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
<tfoot><td>my table foot</td></tfoot>
</table>
<br />
<input type="button" onclick="delRow()"
value="Delete table foot">

</body>
</html>
TIY
ӱɾע819ӱɾtHeadԪؼ()           ɾͷɾͷӱɾ tHead Ԫؼݡ



÷
deleteTHead() ڴӱɾ <thead> Ԫء
﷨
tableObject.deleteTHead()
˵
ñ <thead> ԪأĵɾʲôҲ
ʵ
ɾĽע
<html>
<head>
<script type="text/javascript">
function delRow()
  {
  document.getElementById('myTable').deleteTHead()
  }
</script>
</head>
<body>

<table id="myTable" border="1">
<thead><td>my table head</td></thead>
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="delRow()"
value="Delete table foot">

</body>
</html>
TIY
ӱɾͷ819ڱвһ()                  ССڱвһС



÷
insertRow() ڱеָλòһС
﷨
tableObject.insertRow(index)
ֵ
һ TableRowʾ²С
˵
÷һµ TableRow 󣬱ʾһµ <tr> ǣеָλá
н index ֮ǰ index ڱенӵĩβ
ǿյģн뵽һµ <tbody> ΣöᱻС
׳
 index С 0 ڵڱе÷׳Ϊ INDEX_SIZE_ERR  DOMException 쳣
ʾע
ʾ TableRow.insertCell() ´ݡ
ʵ
ڱĿͷһУ
<html>
<head>
<script type="text/javascript">
function insRow()
  {
  document.getElementById('myTable').insertRow(0)
  }
</script>
</head>

<body>
<table id="myTable" border="1">
<tr>
<td>Row1 cell1</td>
<td>Row1 cell2</td>
</tr>
<tr>
<td>Row2 cell1</td>
<td>Row2 cell2</td>
</tr>
</table>
<br />
<input type="button" onclick="insRow()"
value="Insert new row">

</body>
</html>
TIY
 - Ȼݡ345ԪԪTableCell 
TableCell һ HTML Ԫ
һ HTML ĵ <td> ǩÿһΣһ TableCell ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.842û򷵻صԪݵд汾        ддû򷵻صԪݵд汾




÷
abbr Կû򷵻رԪݵд汾Էǿӵý飬äģ
﷨
tabledataObject.abbr=text
ʵ
ӿʾĳԪ abbr
<html>
<head>
<script type="text/javascript">
function alertAbbr()
  {
  alert(document.getElementById('td1').abbr);
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1" abbr="Some text">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="alertAbbr()" 
value="Alert abbr" />

</body>
</html>
TIY
ĳԪ abbr842û򷵻صԪڲݵˮƽзʽ  û򷵻صԪڲݵˮƽзʽ



÷
align Կû򷵻رԪݵˮƽзʽ
﷨
tabledataObject.align=left|right|center
ʵ
ӰѵԪеұߣ
<html>
<head>
<script type="text/javascript">
function alignCell()
  {
  document.getElementById('td1').align="right"
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="alignCell()" 
value="Align cell" />

</body>
</html>
TIY
 <td> Ԫصзʽ842û򷵻صԪ񶺺ŷָб        û򷵻صԪһŷָб



÷
axis Կû򷵻һɶŷָбаһͣйĵԪ񣩵ơ
axis ԿΪĳԪơ
﷨
tabledataObject.axis=text
ʵ
ӿɷصԪ axis
<<html>
<head>
<script type="text/javascript">
function alertAxis()
  {
  alert(document.getElementById('td3').axis);
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>City</th>
</tr>
<tr>
<td id="td1">Harry</td>
<td id="td2">Potter</td>
<td id="td3" axis="location">NY</td>
</tr>
<tr>
<td id="td4">Peter</td>
<td id="td5">Griffin</td>
<td id="td6" axis="location">Las Vegas</td>
</tr>
</table>
<br />
<input type="button" onclick="alertAxis()"
value="Alert axis" />

</body>
</html>
TIY
ʾԪ axis842صԪĳеĵԪ񼯺еλ    λáλáصԪĳеĵԪ񼯺еλá



÷
cellIndex ԿɷһеĵԪ񼯺еԪλá
﷨
tabledataObject.cellIndex
ʵ
ӿɷԪλãcell index
<html>
<head>
<script type="text/javascript">
function alertTd1()
  {
  alert(document.getElementById('td1').cellIndex);
  }
function alertTd2()
  {
  alert(document.getElementById('td2').cellIndex);
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="alertTd1()" 
value="Alert cell index of 'Peter'" />
<br />
<input type="button" onclick="alertTd2()" 
value="Alert cell index of 'Griffin'" />

</body>
</html>
TIY
ȡõԪ cell index842Ԫ                        Ԫ



÷
colSpan Կû򷵻رԪ
﷨
tabledataObject.colSpan=number_of_columns
ʵ
Ӹ˱Ԫ
<html>
<head>
<script type="text/javascript">
function changeColSpan()
  {
  document.getElementById("td1").colSpan="2";
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeColSpan()
value="Change colspan" />

</body>
</html>
TIY
ıԪ842û򷵻صԪ id                   ididû򷵻صԪ id



÷
id Կû򷵻رԪ id
﷨
tabledataObject.id=id
ʵ
ӷصıԪ id
<html>
<head>
<script type="text/javascript">
function alertId()
  {
  alert(document.getElementById("td1").id);
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertId() value="Alert ID" />

</body>
</html>
TIY
ȡñԪ id842û򷵻صԪʼͽǩ֮HTML  ݡݡû򷵻صԪĿʼǩͽǩ֮ HTML



÷
innerHTML Կû򷵻صԪĿʼǩͽǩ֮ HTML
﷨
tabledataObject.innerHTML=text
ʵ
ӷ˱Ԫ inner HTML
<html>
<head>
<script type="text/javascript">
function alertInnerHTML()
  {
  alert(document.getElementById("td1").innerHTML);
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td1">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertInnerHTML()
value="Alert innerHTML" />
</body>
</html>
TIY
ȡñԪ inner HTML842û򷵻صԪɺ            û򷵻صԪɺ




÷
rowSpan Կû򷵻رԪ
﷨
tabledataObject.rowSpan=number_of_rows
ʵ
Ӹ˱Ԫ
<html>
<head>
<script type="text/javascript">
function changeRowSpan()
  {
  document.getElementById("td2").rowSpan="2";
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
<tr>
<td id="td3">Harry</td>
<td id="td4">Potter</td>
</tr>
</table>
<br />
<input type="button" onclick=changeRowSpan()
value="Change rowspan" />

</body>
</html>
TIY
ıԪ842û򷵻صԪݴֱзʽ      û򷵻رԪݵĴֱзʽ



÷
vAlign û򷵻صԪݵĴֱзʽ
﷨
tabledataObject.vAlign=top|middle|bottom|baseline
ʵ
Ӹ˵ԪݵĴֱзʽ
<html>
<head>
<script type="text/javascript">
function topAlign()
  {
  document.getElementById('td1').vAlign="top";
  document.getElementById('td2').vAlign="top";
  document.getElementById('td3').vAlign="top";
  }
</script>
</head>
<body>

<table width="50%" border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Text</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
<td id="td3">Hello my name is Peter Griffin. 
I need a long text for this example. 
I need a long text for this example.</td>
</tr>
</table>
<br />
<input type="button" onclick="topAlign()"
value="Top-align table cells" />

</body>
</html>
TIY
ĵԪݵĴֱзʽ842û򷵻صԪĿ                  ȫȫû򷵻صԪĿȡ



÷
width û򷵻رԪĿȡ
עͣжܵӰ졣
﷨
tabledataObject.width=percent|pixels
ʵ
Ӹ˱ԪĿȣ
<html>
<head>
<script type="text/javascript">
function changeWidth()
  {
  document.getElementById("td1").width="200px";
  }
</script>
</head>
<body>

<table border="1">
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td id="td1">Peter</td>
<td id="td2">Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=changeWidth() value="Change width" />

</body>
</html>
TIY
ıԪĿȡ345ССTableRow 
TableRow һ HTML С
 HTML ĵ <tr> ǩÿһΣһ TableRow ͻᱻ
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.853ذеԪۼϣ    ذеԪһ顣853û򷵻ݵˮƽ          û򷵻ݵˮƽС



÷
align Կû򷵻еˮƽ뷽ʽ
﷨
tablerowObject.align=left|center|right|justify|char
ʵ
Ӹеˮƽ뷽ʽ
<html>
<head>
<script type="text/javascript">
function leftAlign()
  {
  document.getElementById('header').align="left";
  }
</script>
</head>
<body>

<table width="100%" border="1">
<tr id="header">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="leftAlign()"
value="Left-align table row" />

</body>
</html>
TIY
еĵԪݡ853û򷵻е id                       ididû򷵻е id



÷
id û򷵻رе id
﷨
tablerowObject.id=id
ʵ
ӷ˱е id
<html>
<head>
<script type="text/javascript">
function alertId()
  {
  alert(document.getElementById('tr1').id);
  }
</script>
</head>

<body>
<table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="alertId()"
value="Alert table row ID" />

</body>
</html>
TIY
ȡñе id853û򷵻еĿʼͽǩ֮HTML    ݡݡû򷵻еĿʼǩͽǩ֮ HTML



÷
innerHTML û򷵻رеĿʼͽǩ֮ HTML
﷨
tablerowObject.innerHTML=HTML
ʵ
ӷ˱е inner HTML
<html>
<head>
<script type="text/javascript">
function getInnerHTML()
  {
  alert(document.getElementById("tr1").innerHTML);
  }
</script>
</head>
<body>

<table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="getInnerHTML()" 
value="Alert innerHTML of table row" />

</body>
</html>
TIY
ȡñе inner HTML853ظڱеλ                    λáλáظڱеλá




÷
rowIndex Էĳһڱмеλãrow index
﷨
tablerowObject.rowIndex
ʵ
ӷĳһڱеλã
<html>
<head>
<script type="text/javascript">
function alertRowIndex()
  {
  alert(document.getElementById("tr1").rowIndex);
  }
</script>
</head>
<body>

<table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="alertRowIndex()"
value="Alert row index" />

</body>
</html>
TIY
ĳһڱмеλá853û򷵻еݵĴֱзʽ    û򷵻еݵĴֱзʽ




÷
vAlign û򷵻еĴֱ뷽ʽ
﷨
tablerowObject.vAlign=top|bottom|middle|baseline
ʵ
ӸеĴֱзʽ
<html>
<head>
<script type="text/javascript">
function topAlign()
  {
  document.getElementById('tr2').vAlign="top";
  }
</script>
</head>
<body>

<table width="50%" border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
<th>Text</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
<td>Hello my name is Peter Griffin. 
I need a long text for this example. 
I need a long text for this example.</td>
</tr>
</table>
<br />
<input type="button" onclick="topAlign()"
value="Top-align table row" />

</body>
</html>
TIY
ֱеĵԪݡ853ɾеָĵԪ()                ɾɾɾеָĵԪ



÷
deleteCell() ɾеĵԪ<td> Ԫأ
﷨
tablerowObject.deleteCell(index)
˵
 index ҪɾıԪеλá
÷ɾָλõıԪ
׳
 index С 0 ڵеĵıԪ÷׳Ϊ INDEX_SIZE_ERR  DOMException 쳣
ʵ
ӴɾһԪ
<html>
<head>
<script type="text/javascript">
function delCell()
  {
  document.getElementById('tr2').deleteCell(0)
  }
</script>
</head>
<body>

<table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="delCell()" value="Delete cell">

</body>
</html>
TIY
ɾеһԪ853һеָλòһյԪ()    һеָλòһյ <td> Ԫء



÷
insertCell()  HTML һеָλòһյ <td> Ԫء
﷨
tablerowObject.insertCell(index)
ֵ
һ TableCell 󣬱ʾ´ <td> Ԫء
˵
÷һµ <td> ԪأָλáµԪ񽫱뵱ǰλ index ָλõıԪ֮ǰ index еĵԪµԪ񱻸еĩβ
ע⣬÷ֻܲ <td> ݱԪҪͷԪ Document.createElement()  Node.insertBefore() صķһ <th> Ԫء
׳
 index С 0 ڵеĵıԪ÷׳Ϊ INDEX_SIZE_ERR  DOMException 쳣
ʵ
ڱвһԪ
<html>
<head>
<script type="text/javascript">
function insCell()
  {
  var x=document.getElementById('tr2').insertCell(0)
  x.innerHTML="John"
  }
</script>
</head>
<body>

<table border="1">
<tr id="tr1">
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr id="tr2">
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick="insCell()" value="Insert cell">

</body>
</html>
TIY
һев뵥Ԫ
 - ȻӵԪݡ345ııTextarea 
Textarea  HTML еһı (text-area)ڱ <textarea> ǩÿһΣһ Textarea ͻᱻ
ͨӦԪĳ Textarea 󣬻ʹ getElementById()
IE: Internet Explorer, F: Firefox, O: Opera, W3C: W3C ׼.862û򷵻طtextareaļ̿ݼ      ݼݼû򷵻ط textarea ļ̿ݼ



÷
accessKey û򷵻طıļַ̿
עͣʹ Alt + accessKey ΪӵָݼԪظ轹㡣
﷨
textareaObject.accessKey=accessKey
ʵ
Ϊı涨˿ݼ
<html>
<head>
<script type="text/javascript">
function setAccessKey()
  {
  document.getElementById('txt1').accessKey="t"
  }
</script>
</head>
<body onload="setAccessKey()">

<textarea id="txt1">
Hello world....This is a text area
</textarea>

</body>
</html>862û򷵻 textarea Ŀ              û򷵻 textarea Ŀȡ



÷
cols û򷵻ıַеĿȡ
﷨
textareaObject.cols=number_of_columns
ʵ
ӸĵıĿȣ
<html>
<head>
<script type="text/javascript">
function changeCols()
  {
  document.getElementById('txt1').cols="20";
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="changeCols()" value="Change width" />

</body>
</html>862û򷵻ıеĳʼ            ʼֵʼֵû򷵻ıеĳʼݡ




÷
defaultValue û򷵻ıĳʼݡ
עͣıĳʼֵλ <textarea>  </textarea> ǩ֮ıڱʱı򽫱ָΪֵıԵֵııеǰʾı
﷨
textareaObject.defaultValue=text
ʵ
ʾıĬֵ
<html>
<head>
<script type="text/javascript">
function alertDefaultValue()
  {
  alert(document.getElementById('txt1').defaultValue);
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="alertDefaultValue()" 
value="Alert default value" />

</body>
</html>862û򷵻textareaǷӦ        ááû򷵻 textarea ǷӦá




÷
disabled Կû򷵻ǷӦı
﷨
textareaObject.disabled=true|false
ʵ
ӿɽòı
<html>
<head>
<script type="text/javascript">
function disable()
  {
  document.getElementById('txt1').disabled=true;
  }
function enable()
  {
  document.getElementById('txt1').disabled=false;
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="disable()" value="Disable" />
<input type="button" onclick="enable()" value="Enable" />

</body>
</html>862ض԰textareaı    ض԰ textarea ıá



÷
form Էض԰ text area  á
ɹԷһ form 
﷨
textareaObject.form
ʵ
 text area ı id
<html>
<body>

<form id="form1">
<textarea id="txt1">
Hello world....This is a text area
</textarea>
</form>

<p>The id of the form containing the text area is:
<script type="text/javascript">
x=document.getElementById('txt1');
document.write(x.form.id);
</script>
</p>

</body>
</html>862û򷵻ĳ textarea  id           ididû򷵻ĳ textarea  id



÷
id û򷵻 textarea  id
﷨
textareaObject.id=id
ʵ
ȡ textarea  id
<html>
<head>
<script type="text/javascript">
function alertId()
  {
  alert(document.getElementById('txt1').id);
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a textarea
</textarea>
<br />
<input type="button" onclick="alertId()" value="Alert ID" />

</body>
</html>862û򷵻 textarea               ơơû򷵻 textarea ơ



÷
name û򷵻 textarea ơ
﷨
textareaObject.name=text
ʵ
 textarea ƣ
<html>
<head>
<script type="text/javascript">
function alertName()
  {
  alert(document.getElementById('txt1').name);
  }
</script>
</head>
<body>

<textarea id="txt1" name="textarea1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="alertName()" value="Alert name" />

</body>
</html>862û򷵻textareaǷӦֻ      ֻֻû򷵻 textarea ǷӦֻġ




÷
readOnly û򷵻 textarea ǷΪֻ
﷨
textareaObject.readOnly=true|false
ʵ
 textarea Ϊֻ
<html>
<head>
<script type="text/javascript">
function setReadOnly()
  {
  document.getElementById('txt1').readOnly=true;
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="setReadOnly()" 
value="Make read-only" />

</body>
</html>862û򷵻 textarea ĸ߶              û򷵻 textarea ĸ߶ȡ



÷
rows û򷵻 textarea ĸ߶ȡ
﷨
textareaObject.rows=number_of rows
ʵ
ı textarea ĸ߶ȣ
<html>
<head>
<script type="text/javascript">
function changeRows()
  {
  document.getElementById('txt1').rows="15";
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="changeRows()" value="Change height" />

</body>
</html>862û򷵻textareatabƴ       tabtabû򷵻 textarea  tab ƴ




÷
tabIndex û򷵻 textarea  tab ƴ
﷨
textareaObject.tabIndex=number
ʵ
ͬ tab ƴ
<html>
<head>
<script type="text/javascript">
function checkTab(x)
  {
  alert(x.tabIndex)
  }
</script>
</head>
<body>

<form>
<textarea id="txt1" tabindex="1" onclick="checkTab(this)">
Hello world....This is a text area
</textarea>
<input id="txt2" type="text" tabindex="2" onclick="checkTab(this)">
<input id="txt3" type="text" tabindex="3" onclick="checkTab(this)">
</form>

</body>
</html>862ظıı                  ͡͡ظıı͡



÷
type ԷرԪص͡ text areaԶ "textarea"
﷨
textareaObject.type
ʵ
 textarea Ԫıͣ
<html>
<head>
<script type="text/javascript">
function alertType()
  {
  alert(document.getElementById('txt1').type);
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="alertType()" value="Alert type" />

</body>
</html>862û򷵻 textarea еı          ֵֵû򷵻 textarea еı



÷
value û򷵻 textarea ı
﷨
textareaObject.value=text
ʵ
 textarea Ԫصı
<html>
<head>
<script type="text/javascript">
function alertValue()
  {
  alert(document.getElementById('txt1').value);
  }
</script>
</head>
<body>

<textarea id="txt1">
Hello world....This is a text area
</textarea>
<br />
<input type="button" onclick="alertValue()" value="Alert value" />

</body>
</html>862 textarea ƿ()                  ƽƽ textarea ƿ㡣



÷
blur() ڰѼ̽ӸԪƿ
﷨
textareaObject.blur()
ʵ
òƿıϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('txt1').focus()
  }
function loseFocus()
  {
  document.getElementById('txt1').blur()
  }
</script>
</head>
<body>

<textarea id="txt1">Hello world....</textarea>
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />

</body>
</html>862 textarea ý()                 textarea ý㡣



÷
focus() ڸԪؽ㡣ûصܱ༭ʾıˡ
﷨
textareaObject.focus()
ʵ
òƿıϵĽ㣺
<html>
<head>
<script type="text/javascript">
function setFocus()
  {
  document.getElementById('txt1').focus()
  }
function loseFocus()
  {
  document.getElementById('txt1').blur()
  }
</script>
</head>
<body>

<textarea id="txt1">Hello world....</textarea>
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />

</body>
</html>862ѡ textarea еı()                ѡȡѡȡѡ textarea еı



÷
select() ѡԪеı
﷨
textareaObject.select()
ʵ
ӿѡıеı
<html>
<head>
<script type="text/javascript">
function selText()
  {
  document.getElementById("txt1").select()
  }
</script>
</head>
<body>

<textarea id="txt1">Hello world....</textarea>
<input type="button" value="Select text" onclick="selText()">

</body>
</html>862ֵıʱõ¼  ¼ġġֵıʱõ¼



÷
select() ѡԪеı
﷨
textareaObject.onchange
˵
Textarea  onchange һ¼ûııֵȻͨѼ̽ƶطȷϡЩıʱ򣬵øþ
ע⣬һ Text  value ͨ JavaScript õʱonchange ¼áҪע⣬þΪ˴ֵһı䣬ˣĻϵá-1趨ϡ÷
趨һЩôεļ򻯡-1ݿ汾Ϊ÷
趨һЩôεļ򻯡-1CSSλCSSǩڲ881б                  CSS background 
CSS οֲ
÷
background дһеıԡ

԰˳ԣ

?background-color
?background-image
?background-repeat
?background-attachment
?background-position
еĳֵҲ⣬ background:#ff0000 url('smiley.gif'); Ҳġ

ͨʹԣǷֱʹõԣΪڽϵܹõõ֧֣ҪĸҲ١

881ͼǷ̶߹      ͼ״̬ͼ״̬CSS background-attachment 
CSS οֲ
÷
background-attachment ñͼǷ̶ҳಿֹ

881ɫ                      ɫɫCSS background-color 
CSS οֲ
÷
background-color Ԫصıɫ

ԪرķΧ
background-color ΪԪһִɫɫԪصݡڱ߾ͱ߿չԪر߿߽磨߾ࣩ߿͸֣߱߿򣩣͸Щ͸ʾɫ

transparent ֵ
ڴ£ûбҪʹ transparentϣĳԪӵбɫͬʱֲϣûɫӰ쵽ƣô transparent ֵбҪġ

881ͼ                      ͼͼCSS background-image 
CSS οֲ
÷
background-image ΪԪñͼ

ԪصıռԪصȫߴ磬ڱ߾ͱ߿򣬵߾ࡣ

ĬϵأͼλԪصϽǣˮƽʹֱظ

ʾһֿõıɫĻ米ͼ񲻿ãҳҲɻõӾЧ

ϸ˵
background-image ԻԪصıһͼ

 background-repeat Եֵͼƽ̡ĳᣨx  y ᣩƽ̣߸ƽ̡

ʼͼԭͼ񣩸 background-position Եֵá

881ͼʼλ              ͼʼͼʼCSS background-position 
CSS οֲ
÷
background-position ñͼʼλá

ñԭͼ background-image 壩λãͼҪظһ㿪ʼ

ʾҪ background-attachment Ϊ "fixed"ܱ֤ Firefox  Opera 

881Ƿظͼ        ͼظͼظCSS background-repeat 
CSS οֲ
÷
background-repeat Ƿظͼ

Ĭϵأͼˮƽʹֱظ

ϸ˵
background-repeat Զͼƽģʽ

ԭͼʼظԭͼ background-image 壬 background-position ֵá

881еı߿                ߿߿CSS border 
CSS οֲ
÷
border дһеı߿ԡ

԰˳ԣ

?border-width
?border-style
?border-color
еĳֵҲ⣬ border:solid #ff0000; Ҳġ

881±߿                    ±߿±߿CSS border-bottom 
CSS οֲ
÷
border-bottom д԰±߿õһС

԰˳ԣ

?border-bottom-width
?border-bottom-style
?border-bottom-color
еĳֵҲ⣬ border-bottom:solid #ff0000; Ҳ
881±߿ɫ                  ¿ɫ¿ɫCSS border-bottom-color 
CSS οֲ
÷
border-bottom-color Ԫص±߿ɫ

ֻܶ崿ɫֻе߿ʽһ none  hidden ֵʱ߿ſܳ֡

עͣʼհ border-style  border-color ֮ǰԪرıɫ֮ǰñ߿

881±߿ʽ                  ±߿±߿CSS border-bottom-style 
CSS οֲ
÷
border-bottom-style Ԫ±߿ʽ

ֻеֵ none ʱ߿ſܳ֡

 CSS1 УHTML ûֻ֧ solid  none

881±߿Ŀ                  ¿¿CSS border-bottom-width 
CSS οֲ
÷
border-bottom-width Ԫص±߿Ŀȡ

ֻе߿ʽ none ʱá߿ʽ none߿ʵϻΪ 0ֵָ

עͣʼ border-bottom-width ֮ǰ border-style ԡԪֻڻñ߿֮󣬲ܸı߿Ŀȡ

881߿ɫ                ߿ɫ߿ɫCSS border-color 
CSS οֲ
÷
border-color ߿ɫԿ 1  4 ɫ

border-color һдԣһԪصб߿пɼֵɫΪ 4 ߷ֱòͬɫ
881е߿          ߿߿CSS border-left 
CSS οֲ
÷
border-left д԰߿õһС

԰˳ԣ

?border-left-width
?border-left-style
?border-left-color
еĳֵҲ⣬ border-left:solid #ff0000; Ҳġ

881߿ɫ                  ɫɫCSS border-left-color 
CSS οֲ
÷
border-left-color Ԫص߿ɫ

ֻܶ崿ɫֻе߿ʽһ none  hidden ֵʱ߿ſܳ֡

עͣʼհ border-style  border-color ֮ǰԪرıɫ֮ǰñ߿

881߿ʽ                  ߿߿CSS border-left-style 
CSS οֲ
÷
border-left-style Ԫ߿ʽ

ֻеֵ none ʱ߿ſܳ֡

 CSS1 УHTML ûֻ֧ solid  none

881߿Ŀ                  CSS border-left-width 
CSS οֲ
÷
border-left-width Ԫص߿Ŀȡ

ֻе߿ʽ none ʱá߿ʽ none߿ʵϻΪ 0ֵָ

עͣʼ border-left-width ֮ǰ border-style ԡԪֻڻñ߿֮󣬲ܸı߿Ŀȡ

881ұ߿                    ұ߿ұ߿CSS border-right 
CSS οֲ
÷
border-right д԰ұ߿õһС

԰˳ԣ

?border-right-width
?border-right-style
?border-right-color
еĳֵҲ⣬ border-right:solid #ff0000; Ҳġ

881ұ߿ɫ                  ҿɫҿɫCSS border-right-color 
CSS οֲ
÷
border-right-color Ԫصұ߿ɫ

ֻܶ崿ɫֻе߿ʽһ none  hidden ֵʱ߿ſܳ֡

עͣʼհ border-style  border-color ֮ǰԪرıɫ֮ǰñ߿
881ұ߿ʽ                  ұ߿ұ߿CSS border-right-style 
CSS οֲ
÷
border-right-style Ԫұ߿ʽ

ֻеֵ none ʱ߿ſܳ֡

 CSS1 УHTML ûֻ֧ solid  none

881ұ߿Ŀ                  ҿҿCSS border-right-width 
CSS οֲ
÷
border-right-width Ԫصұ߿Ŀȡ

ֻе߿ʽ none ʱá߿ʽ none߿ʵϻΪ 0ֵָ

עͣʼ border-right-width ֮ǰ border-style ԡԪֻڻñ߿֮󣬲ܸı߿Ŀȡ

881߿ʽ                ߿ʽ߿ʽCSS border-style 
CSS οֲ
÷
border-style Ԫб߿ʽߵΪñ߿ʽ

ֻеֵ none ʱ߿ſܳ֡

 1
border-style:dotted solid double dashed; ?ϱ߿ǵ״
?ұ߿ʵ
?±߿˫
?߿
 2
border-style:dotted solid double;?ϱ߿ǵ״
?ұ߿߿ʵ
?±߿˫
 3
border-style:dotted solid;?ϱ߿±߿ǵ״
?ұ߿߿ʵ
 4
border-style:dotted;? 4 ߿ǵ״
881ϱ߿                    ϱ߿ϱ߿CSS border-top 
CSS οֲ
÷
border-top д԰ϱ߿õһС

԰˳ԣ

?border-top-width
?border-top-style
?border-top-color
еĳֵҲ⣬ border-top:solid #ff0000; Ҳġ

881ϱ߿ɫ                  ϿɫϿɫCSS border-top-color 
CSS οֲ
÷
border-top-color Ԫصϱ߿ɫ

ֻܶ崿ɫֻе߿ʽһ none  hidden ֵʱ߿ſܳ֡

עͣʼհ border-style  border-color ֮ǰԪرıɫ֮ǰñ߿

881ϱ߿ʽ                  ϿʽϿʽCSS border-top-style 
CSS οֲ
÷
border-top-style Ԫϱ߿ʽ

ֻеֵ none ʱ߿ſܳ֡

 CSS1 УHTML ûֻ֧ solid  none

881ϱ߿Ŀ                  ϿϿCSS border-top-width 
CSS οֲ
÷
border-top-width Ԫصϱ߿Ŀȡ

ֻе߿ʽ none ʱá߿ʽ none߿ʵϻΪ 0ֵָ

עͣʼ border-top-width ֮ǰ border-style ԡԪֻڻñ߿֮󣬲ܸı߿Ŀȡ

881߿Ŀ                ߿߿CSS border-width 
CSS οֲ
÷
border-width дΪԪصб߿ÿȣߵΪ߱߿ÿȡ

ֻе߿ʽ none ʱá߿ʽ none߿ʵϻΪ 0ֵָ

 1
border-width:thin medium thick 10px;?ϱ߿ϸ߿
?ұ߿еȱ߿
?±߿Ǵֱ߿
?߿ 10px ı߿
 2
border-width:thin medium thick;?ϱ߿ 10px
?ұ߿߿еȱ߿
?±߿Ǵֱ߿
 3
border-width:thin medium;?ϱ߿±߿ϸ߿
?ұ߿߿еȱ߿
 4
border-width:thin;? 4 ߿ϸ߿
881е                CSS outline 
CSS οֲ
÷
outline ǻԪΧһߣλڱ߿ԵΧͻԪصá

ע߲ͣռݿռ䣬ҲһǾΡ

outline дһеԡ

԰˳ԣ

?outline-color
?outline-style
?outline-width
еĳֵҲ⣬ outline:solid #ff0000; Ҳ
881ɫ                    ɫɫCSS outline-color 
CSS οֲ
÷
outline ǻԪΧһߣλڱ߿ԵΧͻԪصáoutline ԿԪΧߡ

עͣʼ outline-color ֮ǰ outline-style ԡԪֻлԺܸıɫ

ע߲ͣռݿռ䣬ҲһǾΡ

outline-color һԪпɼֵɫҪסʽ none֡

881ʽ                    ʽʽCSS outline-style 
CSS οֲ
÷
outline-style Ԫصʽʽ none֡

outline ǻԪΧһߣλڱ߿ԵΧͻԪصáoutline ԪΧߡ

עͣʼ outline-color ֮ǰ outline-style ԡԪֻлԺܸıɫ

ע߲ͣռݿռ䣬ҲһǾΡ

881Ŀ                    CSS outline-width 
CSS οֲ
÷
outline-width ԪĿȣֻеʽ none ʱȲŻáʽΪ noneʵϻΪ 0øֵ

outlineǻԪΧһߣλڱ߿ԵΧͻԪصáoutline ԪΧߡ

עͣʼ outline-width ֮ǰ outline-style ԡԪֻлԺܸıɫ

ע߲ͣռݿռ䣬ҲһǾΡ

881ıɫ                    ıɫıɫCSS color 
CSS οֲ
÷
color Թ涨ıɫ

һԪصǰɫ HTML УԪıɫդͼ color Ӱ졣ɫӦõԪصб߿򣬳Ǳ border-color ĳ߿ɫԸǡ

ҪһԪصǰɫ׵ķʹ color ԡ

881ı                      ııCSS direction 
CSS οֲ
÷
direction Թ涨ıķ / д

ָ˿ĻдԼ Unicode ˫㷨Ƕ͸Ƿ򡣲֧˫ıûԺԡ

881ַ                      ּּCSS letter-spacing 
CSS οֲ
÷
letter-spacing ӻַĿհףַࣩ

Զıַ֮ٿռ䡣ַַͨҪխֵָʱĸ֮ͨļˣnormal ൱ֵΪ 0

עͣʹøֵĸ֮伷ø

881и                          иߡиߡCSS line-height 
CSS οֲ
÷
line-height мľ루иߣ

עͣʹøֵ

˵
ԻӰпĲ֡Ӧõһ鼶Ԫʱ˸Ԫл֮С롣

line-height  font-size ļֵ֮ CSS гΪмࡱΪ룬ֱӵһıݵĶ͵ײ԰ЩݵСп

ԭʼֵָһӣԪػ̳ӶǼֵ

881ıˮƽ뷽ʽ            ĺĺCSS text-align 
CSS οֲ
÷
text-align Թ涨Ԫеıˮƽ뷽ʽ

ָͨпĸ룬Ӷÿ鼶Ԫıˮƽ뷽ʽͨûĸ֮ļֵ֧ justifyͬûܻõͬĽ

881װЧ                      װЧװЧCSS text-decoration 
CSS οֲ
÷
text-decoration Թ涨ӵıΡ

עͣεɫ "color" á

˵
ıĳЧ»ߡԪûԼװΣԪõװλᡰ족ԪСҪû֧ blink

881е                  CSS text-indent 
CSS οֲ

text-indent Թ涨ıı

עͣʹøֵʹøֵôлᱻߡ

ע⣺ CSS 2.1 ֮ǰtext-indent Ǽ̳мֵֵ

˵
ڶ鼶ԪеһеڽһǩҳЧֵָһ֡Ч

881ӰЧ                      ӰЧӰЧ涨ӵıӰЧ881Сд                        СдСдCSS text-transform 
CSS οֲ
÷
text-transform ԿıĴСд

˵
ԻıԪеĸСдԴĵıĴСдֵΪ capitalizeҪĳЩĸдǲûȷȷЩĸҪдȡûʶʡ

881ı                      ııCSS unicode-bidi 
CSS οֲ

unicode-bidi ıķ

̳ԣYes

˵
 CSS ͼд򣬵 Unicode һָ׳ķʽԡ unicode-bidiCSS ԱԳ Unicode ĳЩܡ
881δԪеĿհ          ԪؿհסԪؿհסCSS white-space 
CSS οֲ
÷
white-space δԪڵĿհס

ֹδԪеĿհ׷ֵ pre-wrap  pre-line  CSS 2.1 ġ

881ʼ                      ʼʼCSS word-spacing 
CSS οֲ

word-spacing ӻٵʼĿհףּ

ԶԪ֮ٿհ׷ԣ֡ Ϊɿհ׷ΧһַָΪֵ֮ͨԣnormal ͵ͬΪ 0ֵָ֮伷ø

עͣʹøֵ

881                  CSS font 
CSS οֲ
÷
font дһԡ

עͣҲеֵ"line-height"мࡣ

˵
дһԪ෽档ʹ icon ȹؼֿʵԪص壬ʹ֮ûеĳһ¡ע⣬ûʹЩؼʣҪָСϵС

԰˳ԣ

?font-style
?font-variant
?font-weight
?font-size/line-height
?font-family
Բеĳֵ font:100% verdana; ҲġδõԻʹĬֵ

881ϵ                      ϵСϵСCSS font-family 
CSS οֲ
÷
font-family 涨ԪصϵС

font-family ԰ѶΪһˡϵͳ档ֵ֧һ壬᳢һҲ˵font-family ԵֵĳԪصƻ/Ƶһȱʹʶĵһֵ

͵ϵƣ

?ָϵƣƣ磺"times""courier""arial"
?ͨϵƣ磺"serif""sans-serif""cursive""fantasy""monospace"
ʾʹöŷָÿֵʼṩһΪѡ

ע⣺ʹĳضϵУGenevaȫȡûϸϵǷãûָʾκءˣǿƼʹһͨϵΪ·

881ߴ                      ߴߴCSS font-size 
CSS οֲ
÷
font-size Կĳߴ硣

˵
ԪصСע⣬ʵõַĸ߶ȣʵʵַοܱЩ߻򰫣ͨᰫ

ؼֶӦһСؼӦҪߣҪСһؼֶӦ塣

881涨 aspect ֵ                aspectֵaspectֵCSS font-size-adjust 
CSS οֲ
÷
font-size-adjust ΪĳԪع涨һ aspect ֵͿԱѡ x-height

˵
Сдĸ "x" ĸ߶ "font-size" ߶֮ıʱΪһ aspect ֵӵиߵ aspect ֵʱô屻ΪСĳߴʱĶVerdana  aspect ֵ 0.58ζŵߴΪ 100px ʱ x-height  58px Times New Roman  aspect ֵ 0.46ζ Verdana Сߴʱ Times New Roman Ķ

881                    CSS font-stretch 
CSS οֲ
÷
font-stretch ԿɶԵǰ font-family Ρ

881ʽ                      ʽʽCSS font-style 
CSS οֲ
÷
font-style Զķ

˵
ʹб塢б塣бͨΪϵеһ塣ϽûԸһб塣

881Сʹдĸ                  СʹдСʹдCSS font-variant 
CSS οֲ
÷
font-variant СʹдĸʾıζеСдĸᱻתΪдʹСʹдĸıȣߴС

˵
ҪڶСʹдĸıϣûԸСʹдĸ塣

881Ĵϸ                    ϸϸCSS font-weight 
CSS οֲ
÷
font-weight ıĴϸ

˵
ʾԪصıõӴֵ֡ 400 ൱ ؼ normal700 ȼ boldÿֵӦӴֱһСһϸһһ֡

881߾                ߾߾CSS margin 
CSS οֲ
÷
margin дһ߾ԡԿ 1  4 ֵ

˵
дһԪ߾Ŀȣø߾Ŀȡ

鼶ԪصĴֱ߾ϲԪʵϲռ߾ࡣԪصĵ߾಻ϲͬأԪص߾Ҳϲָ߾ֵʹʱҪСġ

עͣʹøֵ

 1
margin:10px 5px 15px 20px;?߾ 10px
?߾ 5px
?߾ 15px
?߾ 20px
 2
margin:10px 5px 15px;?߾ 10px
?߾߾ 5px
?߾ 15px
 3
margin:10px 5px;?߾߾ 10px
?߾߾ 5px
 4
margin:10px;? 4 ߾඼ 10px
881߾                      ߾߾CSS margin-bottom 
CSS οֲ
÷
margin-bottom Ԫص߾ࡣ

עͣʹøֵ

881߾                      ߾߾CSS margin-left 
CSS οֲ
÷
margin-left Ԫص߾ࡣ

עͣʹøֵ

881߾                      ߾߾CSS margin-right 
CSS οֲ
÷
margin-right Ԫص߾ࡣ

עͣʹøֵ

881߾                      ߾߾CSS margin-top 
CSS οֲ
÷
margin-top Ԫص߾ࡣ

עͣʹøֵ

881ڱ߾                ڱ߾ڱ߾CSS padding 
CSS οֲ
÷
padding дһڱ߾ԡ

˵
дԪڱ߾Ŀȣøڱ߾Ŀȡڷ滻Ԫõڱ߾಻Ӱи߼㣻ˣһԪؼڱ߾бӾϿܻ쵽УпܻصԪصı촩ڱ߾ࡣָ߾ֵ

עͣʹøֵ

 1
padding:10px 5px 15px 20px;?ڱ߾ 10px
?ڱ߾ 5px
?ڱ߾ 15px
?ڱ߾ 20px
 2
padding:10px 5px 15px;?ڱ߾ 10px
?ڱ߾ڱ߾ 5px
?ڱ߾ 15px
 3
padding:10px 5px;?ڱ߾ڱ߾ 10px
?ڱ߾ڱ߾ 5px
 4
padding:10px;? 4 ڱ߾඼ 10px
881ڱ߾                      ڱ߾ڱ߾CSS padding-bottom 
CSS οֲ
÷
padding-bottom Ԫصڱ߾ࣨײհף

˵
Ԫڱ߾Ŀȡڷ滻Ԫõڱ߾಻Ӱи߼㣬ˣһԪؼڱ߾бӾϿ쵽Упܻصָڱ߾ֵ

עͣʹøֵ

881ڱ߾                      ڱ߾ڱ߾CSS padding-left 
CSS οֲ
÷
padding-left Ԫڱ߾ࣨհף

˵
Ԫڱ߾Ŀȡڷ滻Ԫõڱ߾Ԫɵĵһڿ߳.

עͣʹøֵ

881ڱ߾                      ڱ߾ڱ߾CSS padding-right 
CSS οֲ
÷
padding-right Ԫڱ߾ࣨհף

עͣʹøֵ

˵
Ԫڱ߾Ŀȡڷ滻Ԫõڱ߾Ԫɵĵһڿұ߳.

881ڱ߾                      ڱ߾ڱ߾CSS padding-top 
CSS οֲ
÷
padding-top Ԫصڱ߾ࣨռ䣩

˵
Ԫڱ߾Ŀȡڷ滻Ԫõڱ߾಻Ӱи߼㣬ˣһԪؼڱ߾бӾϿ쵽Упܻصָڱ߾ֵ

עͣʹøֵ

881еб                ббCSS list-style 
CSS οֲ
÷
list-style дһебԡ

˵
һдԣбʽԡӦõ display Ϊ list-item Ԫأͨ HTML  XHTML ֻ li ԪأʵӦõκԪأ list-item Ԫؼ̳С

԰˳ԣ

?list-style-type
?list-style-position
?list-style-image
Բеĳֵ "list-style:circle inside;" ҲġδõԻʹĬֵ

881ͼб                ͼǡͼǡCSS list-style-image 
CSS οֲ
÷
list-style-image ʹͼ滻бıǡ

˵
ָΪһб־ͼͼбݵķλͨʹ list-style-position Կơ

עͣʼչ涨һ "list-style-type" Էͼ񲻿á

881бǵķλ          λáλáCSS list-style-position 
CSS οֲ
÷
list-style-position ںδбǡ

˵
б־бݵλáⲿ (outside) ־б߿߽һ봦 CSS δ塣ڲ (inside) ־ΪǲбǰԪһ

881бǵ              ͡͡CSS list-style-type 
CSS οֲ
÷
list-style-type бǵ
881ˮƽ                      ˮƽסˮƽסmarker-offsetauto  length



auto : Զü

length : ɸֺ͵λʶɵĳֵΪֵĳȵλ 

marker-offset˵ 

û֮ˮƽסһߵļࡣ

ĿǰIE5.5вִ֧ԡ

ӦĽűΪmarkerOffsetұдĿ 

marker-offsetʾ

li:before { display: marker; marker-offset: 5px; }

881                  ݡݡCSS content 
CSS οֲ
÷
content  :before  :after αԪʹãݡ

˵
ڶԪ֮ǰ֮õݡĬϵأݣݴĿͿ display ơ

881ݼһ    CSS counter-increment 
CSS οֲ
÷
counter-increment ĳѡȡÿγֵļĬ 1

˵
ԣԵݼĳֵֵֵûṩ number ֵĬΪ 1

עͣʹ "display: none"޷Ӽʹ "visibility: hidden"Ӽ

881һ    üüCSS counter-reset 
CSS οֲ
÷
counter-reset ĳѡִļֵĬΪ 0

ԣûΪκֵֵֵûṩ numberĬΪ 0

עͣʹ "display: none"޷üʹ "visibility: hidden"ü

881Ƕõ            Ƕ͡Ƕ͡CSS quotes 
CSS οֲ
÷
quotes Ƕãembedded quotation͡

881߶                          ߶ȡ߶ȡCSS height 
CSS οֲ
÷
height Ԫصĸ߶ȡ

˵
ԶԪĸ߶ȣڱ߾ࡢ߿߾ࡣ

ڷ滻Ԫػԡ

881߶                      ߶ȡ߶ȡCSS max-height 
CSS οֲ
÷
max-height Ԫص߶ȡ

˵
ֵԪصĸ߶һơˣԪؿԱֵָܱߡֵָ

עͣmax-height Բ߾ࡢ߿ڱ߾ࡣ

881С߶                      С߶ȡС߶ȡCSS min-height 
CSS οֲ
÷
min-height ԪصС߶ȡ

˵
ֵԪصĸ߶һơˣԪؿԱֵָߣܱ䰫ֵָ

881С                      СȡСȡCSS min-width 
CSS οֲ
÷
min-width ԪصСȡ

˵
ֵԪصĿһСơˣԪؿԱֵָܱխֵָ

881                          ȡȡCSS width 
CSS οֲ
÷
width ԪصĿȡ

˵
ԶԪĿȣڱ߾ࡢ߿߾ࡣ

ڷ滻Ԫػԡ

881ԪصĵײԵ                ױԵױԵCSS bottom 
CSS οֲ
÷
bottom Թ涨ԪصĵײԵԶ˶λԪ߾߽±߽֮ƫơ

עͣ "position" ԵֵΪ "static"ô "bottom" ԲκЧ

˵
 static ԪأΪ autoڳֵΪӦľԳȣڰٷֱֵΪֵָΪ auto

ԶԪأ bottom  top  autoֵ 0֮һΪ autoȡһֵ෴߶ autobottom ȡ top ֵ෴

881Ԫز          CSS clear 
CSS οֲ
÷
clear Թ涨Ԫصһ಻Ԫء

˵
clear ԶԪصıϲָԪء CSS1  CSS2 УͨԶΪԪأ clear ԵԪأ߾ʵֵġ CSS2.1 УԪ߾֮ռ䣬߾౾ı䡣һָı䣬սһΪ߻ұʹԪص߿߽պڸñϸԪص߾߽֮¡

881þԶλԪ              ááCSS clip 
CSS οֲ
÷
clip ԼþԶλԪء

һͼĳߴڰԪʱᷢʲôأ"clip" 涨һԪصĿɼߴ磬Ԫؾͻᱻ޼ʾΪ״

˵
ڶһþΡһԶԪأڵݲſɼݻ overflow ֵܱԪصҲܱС

881                    ͡͡CSS cursor 
CSS οֲ
÷
cursor Թ涨ҪʾĹͣ״

ԶָһԪر߽緶ΧʱõĹ״ CSS2.1 ûжĸ߽ȷΧ

881                      ͡͡CSS display 
CSS οֲ
÷
display Թ涨ԪӦɵĿ͡

˵
ڶ彨ʱԪɵʾ͡ HTML ĵͣʹ display ΣգΪΥ HTML Ѿʾνṹ XML XML ûõֲνṹ display ǾԱҪġ

עͣCSS2 ֵ compact  markerȱ㷺֧֣Ѿ CSS2.1 ȥˡ

881ǷӦø                Ƿ񸡶Ƿ񸡶CSS float 
CSS οֲ
÷
float ԶԪĸ򸡶ӦͼʹıΧͼΧ CSS УκԪضԸԪػһ鼶򣬶ǺԪء

滻ԪأҪָһȷĿȣǻᾡܵխ

עͣһֻ֮мٵĿռɹԪأôԪػһУ̻ĳһӵ㹻ĿռΪֹ

881ԪصԵ                  ԵԵCSS left 
CSS οֲ
÷
left Թ涨ԪصԵԶ˶λԪ߾߽߽֮ƫơ

עͣ "position" ԵֵΪ "static"ô "left" ԲκЧ

˵
 static ԪأΪ autoڳֵΪӦľԳȣڰٷֱֵΪֵָΪ auto

ԶԪأleft ļֵʼյ right

881Ԫؿʱ  CSS overflow 
CSS οֲ
÷
overflow Թ涨Ԫؿʱ顣

˵
ԶԪݻδֵΪ scrollǷҪûṩһֹơˣпܼʹԪؿпԷҲֹ

881ԪصĶλ                λ͡λ͡CSS position 
CSS οֲ
÷
position Թ涨ԪصĶλ͡

˵
Զ彨ԪزõĶλơκԪضԶλԻ̶Ԫػһ鼶򣬶۸Ԫرʲô͡ԶλԪػеĬλƫơ

881ԪصұԵ                  ұԵұԵCSS right 
CSS οֲ
÷
right Թ涨ԪصұԵԶ˶λԪ߾߽ұ߽֮ƫơ

עͣ "position" ԵֵΪ "static"ô "right" ԲκЧ

˵
 static ԪأΪ autoڳֵΪӦľԳȣڰٷֱֵΪֵָΪ auto

ԶԪأleft ļֵʼյ right

881ԪصĶԵ                ԵԵCSS top 
CSS οֲ
÷
top Թ涨ԪصĶԵԶһλԪص߾߽ϱ߽֮ƫơ

עͣ "position" ԵֵΪ "static"ô "top" ԲκЧ

˵
 static ԪأΪ autoڳֵΪӦľԳȣڰٷֱֵΪֵָΪ auto

ԶԪأ top  bottom  autoֵ 0֮һΪ autoȡһֵ෴߶ autobottom ȡ top ֵ෴

881ֱ뷽ʽ                  CSS vertical-align 
CSS οֲ
÷
vertical-align ԪصĴֱ뷽ʽ

˵
ԶԪصĻڸԪеĻߵĴֱ롣ֵָͰٷֱֵʹԪؽͶߡڱԪУԻõԪеĵԪݵĶ뷽ʽ

881ԪǷɼ                  ɼɼCSS visibility 
CSS οֲ
÷
visibility Թ涨ԪǷɼ

ʾʹɼԪҲռҳϵĿռ䡣ʹ "display" ռҳռĲɼԪء

˵
ָǷʾһԪɵԪؿζԪռ䱾Ŀռ䣬ȫɼֵ collapse ڱڴӱɾлС

881ԪصĶѵ˳                ѵ˳ѵ˳CSS z-index 
CSS οֲ
÷
z-index ԪصĶѵ˳ӵи߶ѵ˳Ԫǻᴦڶѵ˳ϵ͵Ԫصǰ档

עͣԪؿӵи z-index ֵ

עͣZ-index ڶλԪЧ position:absolute;

˵
һλԪ z λãz ᶨΪֱ쵽ʾᡣΪûΪʾûԶ

881ԪغķҳΪ              ҳҳCSS page-break-after 
CSS οֲ
÷
page-break-after Ԫغ page-breaking Ϊ

ܿ always ǿƷϷҳ޷֤ҳĲ룬ԱֻҪûܱҳ

Ӧڣposition ֵΪ relative  static ķǸ鼶Ԫء

עͣ뾡ٵʹ÷ҳԣұڱ񡢸Ԫءб߿ĿԪʹ÷ҳԡ

881ԪǰķҳΪ              ǰҳǰҳCSS page-break-before 
CSS οֲ
÷
page-break-before Ԫǰ page-breaking Ϊ

ܿ always ǿƷϷҳ޷֤ҳĲ룬ԱֻҪûܱҳ

Ӧڣposition ֵΪ relative  static ķǸ鼶Ԫء

עͣ뾡ٵʹ÷ҳԣұڱ񡢸Ԫءб߿ĿԪʹ÷ҳԡ

881ԪڲķҳΪ            ڷҳڷҳCSS page-break-inside 
CSS οֲ
÷
page-break-inside Ԫڲ page-breaking Ϊ

ܿ always ǿƷϷҳ޷֤ҳĲ룬ԱֻҪûܱҳ

Ӧڣposition ֵΪ relative  static ķǸ鼶Ԫء

עͣ뾡ٵʹ÷ҳԣұڱ񡢸Ԫءб߿ĿԪʹ÷ҳԡ

881Ƿϲ߿              ߿ϲ߿ϲCSS border-collapse 
CSS οֲ
÷
border-collapse ñı߿Ƿ񱻺ϲΪһһı߿򣬻ڱ׼ HTML ֿʾ
881ڵԪ߿֮ľ      ڸڸCSS border-spacing 
CSS οֲ
÷
border-spacing ڵԪı߿ľ루ڡ߿롱ģʽ

עͣĳЩ汾IEִ֧ԡ

˵
ָָ߿ģеԪ߽֮ľ롣ֵָУһˮƽڶǴֱ border-collapse Ϊ separate򽫺ԡֻӦڱɱеԪؼ̳С

881λ                λáλáCSS caption-side 
CSS οֲ
÷
caption-side ñλá

˵
ָ˱ڱķλáʾΪǱ֮ǰ֮󣩵һ鼶Ԫء

881ǷʾеĿյԪ      յԪʾյԪʾCSS empty-cells 
CSS οֲ
÷
empty-cells ǷʾеĿյԪ񣨽ڡ߿ģʽ

עͣĳЩ汾 IE ִ֧ԡ

˵
Զ˲κݵıԪαʾʾͻƳԪı߿ͱ border-collapse Ϊ separate򽫺ԡ

881ʾԪСе㷨㷨㷨CSS table-layout 
CSS οֲ
÷
tableLayout ʾԪСе㷨

̶񲼾֣
̶񲼾Զ񲼾ȣضԱв֡

ڹ̶񲼾Уˮƽֽȡڱȡпȡ߿ȡԪ࣬뵥Ԫ޹ء

ͨʹù̶񲼾֣ûڽյһкͿʾ

Զ񲼾֣
Զ񲼾УеĿеԪûе趨ġ

㷨ʱҪȷյĲ֮ǰʱеݡ

˵
ָɱʱõĲ㷨̶㷨ȽϿ죬ǲ̫Զ㷨Ƚܷӳͳ HTML 

-1HTMLǩԼǩԡ978                ÷
<!DOCTYPE> λĵеǰλã <html> ǩ֮ǰ˱ǩɸ֪ĵʹ HTML  XHTML 淶

ñǩ DTD ֱͣʾϸ汾ɰ汾Լڿܵ HTML ĵ

978ҳ                ҳҳ÷
Ԫؿɸ֪һ HTML ĵ

<html>  </html> ǩ޶ĵĿʼͽ㣬֮ĵͷ塣˽ĵͷ <head> ǩ壬 <body> ǩ塣
978                HTML <body> ǩ
÷
body Ԫضĵ塣

body Ԫذĵݣıӡͼ񡢱бȵȡ
981                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
981ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ981ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
981ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
981Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο981Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
981tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ981ĵ          ĵʱִнű981ĵж          ж¡ж¡ĵжʱִнű981Ԫظı            ııԪظıʱִнű981ύ          ύύύʱִнű981          ááʱִнű981Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű981Ԫʧȥ        ʧʧԪʧȥʱִнű981Ԫػý        ýýԪػýʱִнű981ͼж        ضϡضϡͼжʱִнű981̱          ̱ʱִнű981ºɿ        ɡɡ̱ºɿʱִнű981̱ɿ          ɡɡ̱ɿʱִнű981걻          걻ʱִнű981걻˫          ˫˫걻˫ʱִнű981갴ť      󰴡󰴡갴ťʱִнű981ƶ            ơơָƶʱִнű981Ƴ            ָƳĳԪʱִнű981ͣ            ָͣĳԪ֮ʱִнű981갴ťɿ      ɡɡ갴ťɿʱִнű981ɫ            ɫɫHTML <body> ǩ alink 
HTML <body> ǩ
÷
alink Թ涨ĵлӣactive linkĵɫ
עͣӱʱӾʹڻ״̬
ʵ
ĵлӵɫΪɫ
<html>
<body alink="green">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>
TIY981ͼ            ͼͼHTML <body> ǩ background 
HTML <body> ǩ
÷
background Թ涨涨ĵıͼ
עͣӱʱӾʹڻ״̬
ʵ
Ϊĵ涨һͼ
<html>
<body background="bgimage.jpg">
<h1>Hello world!</h1>
<p><a href="http://www.w3school.com.cn">Visit W3School.com.cn!</a></p>
</body>
</html>981ɫ            ɫɫHTML <body> ǩ bgcolor 
HTML <body> ǩ
÷
bgcolor Թ涨ĵıɫ
ʵ
Ϊĵ涨ɫ
<html>
<body bgcolor="#E6E6FA">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>981δɫ      δɫδɫHTML <body> ǩ link 
HTML <body> ǩ
÷
link Թ涨ĵδӵĬɫ
ʵ
ĵеĬɫΪɫ
<html>
<body link="blue">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>981ıɫ            ɫɫHTML <body> ǩ text 
HTML <body> ǩ
÷
text Թ涨 HTML ĵıɫ
ʵ
ĵеıɫ
<html>
<body text="green">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>981ѱɫ    ѷɫѷɫHTML <body> ǩ vlink 
HTML <body> ǩ
÷
vlink ĵѱӵɫ
ʵ
ĵѱʵɫΪɫ
<html>
<body vlink="red">
<p><a href="http://www.w3school.com.cn">W3School.com.cn</a></p>
<p><a href="http://www.w3school.com.cn/html/">HTML Tutorial</a></p>
</body>
</html>9781               11÷
<h1> - <h6> ǩɶ⡣<h1> ı⡣<h6> Сı⡣

 h Ԫӵȷе壬صѡǡıǩ㼶ĵĽṹˣ벻ҪñǩıͬһеС෴ӦʹòʽﵽƯʾЧ

ϣ˽й HTML ǩѡʹõϢĶWeb Ʒʡ
1014                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1014ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1014ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1014ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1014Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1014Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1014tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1014ĵ          ĵʱִнű1014ĵж          ж¡ж¡ĵжʱִнű1014Ԫظı            ııԪظıʱִнű1014ύ          ύύύʱִнű1014          ááʱִнű1014Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1014Ԫʧȥ        ʧʧԪʧȥʱִнű1014Ԫػý        ýýԪػýʱִнű1014ͼж        ضϡضϡͼжʱִнű1014̱          ̱ʱִнű1014ºɿ        ɡɡ̱ºɿʱִнű1014̱ɿ          ɡɡ̱ɿʱִнű1014걻          걻ʱִнű1014걻˫          ˫˫걻˫ʱִнű1014갴ť      󰴡󰴡갴ťʱִнű1014ƶ            ơơָƶʱִнű1014Ƴ            ָƳĳԪʱִнű1014ͣ            ָͣĳԪ֮ʱִнű1014갴ťɿ      ɡɡ갴ťɿʱִнű1014ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>
TIY9782               22 1042                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1042ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1042ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1042ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1042Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1042Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1042tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1042ĵ          ĵʱִнű1042ĵж          ж¡ж¡ĵжʱִнű1042Ԫظı            ııԪظıʱִнű1042ύ          ύύύʱִнű1042          ááʱִнű1042Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1042Ԫʧȥ        ʧʧԪʧȥʱִнű1042Ԫػý        ýýԪػýʱִнű1042ͼж        ضϡضϡͼжʱִнű1042̱          ̱ʱִнű1042ºɿ        ɡɡ̱ºɿʱִнű1042̱ɿ          ɡɡ̱ɿʱִнű1042걻          걻ʱִнű1042걻˫          ˫˫걻˫ʱִнű1042갴ť      󰴡󰴡갴ťʱִнű1042ƶ            ơơָƶʱִнű1042Ƴ            ָƳĳԪʱִнű1042ͣ            ָͣĳԪ֮ʱִнű1042갴ťɿ      ɡɡ갴ťɿʱִнű1042ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>9783               33 1070                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1070ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1070ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1070ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1070Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1070Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1070tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1070ĵ          ĵʱִнű1070ĵж          ж¡ж¡ĵжʱִнű1070Ԫظı            ııԪظıʱִнű1070ύ          ύύύʱִнű1070          ááʱִнű1070Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1070Ԫʧȥ        ʧʧԪʧȥʱִнű1070Ԫػý        ýýԪػýʱִнű1070ͼж        ضϡضϡͼжʱִнű1070̱          ̱ʱִнű1070ºɿ        ɡɡ̱ºɿʱִнű1070̱ɿ          ɡɡ̱ɿʱִнű1070걻          걻ʱִнű1070걻˫          ˫˫걻˫ʱִнű1070갴ť      󰴡󰴡갴ťʱִнű1070ƶ            ơơָƶʱִнű1070Ƴ            ָƳĳԪʱִнű1070ͣ            ָͣĳԪ֮ʱִнű1070갴ťɿ      ɡɡ갴ťɿʱִнű1070ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>9784               44 1098                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1098ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1098ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1098ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1098Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1098Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1098tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1098ĵ          ĵʱִнű1098ĵж          ж¡ж¡ĵжʱִнű1098Ԫظı            ııԪظıʱִнű1098ύ          ύύύʱִнű1098          ááʱִнű1098Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1098Ԫʧȥ        ʧʧԪʧȥʱִнű1098Ԫػý        ýýԪػýʱִнű1098ͼж        ضϡضϡͼжʱִнű1098̱          ̱ʱִнű1098ºɿ        ɡɡ̱ºɿʱִнű1098̱ɿ          ɡɡ̱ɿʱִнű1098걻          걻ʱִнű1098걻˫          ˫˫걻˫ʱִнű1098갴ť      󰴡󰴡갴ťʱִнű1098ƶ            ơơָƶʱִнű1098Ƴ            ָƳĳԪʱִнű1098ͣ            ָͣĳԪ֮ʱִнű1098갴ťɿ      ɡɡ갴ťɿʱִнű1098ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>9785               55 1126                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1126ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1126ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1126ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1126Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1126Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1126tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1126ĵ          ĵʱִнű1126ĵж          ж¡ж¡ĵжʱִнű1126Ԫظı            ııԪظıʱִнű1126ύ          ύύύʱִнű1126          ááʱִнű1126Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1126Ԫʧȥ        ʧʧԪʧȥʱִнű1126Ԫػý        ýýԪػýʱִнű1126ͼж        ضϡضϡͼжʱִнű1126̱          ̱ʱִнű1126ºɿ        ɡɡ̱ºɿʱִнű1126̱ɿ          ɡɡ̱ɿʱִнű1126걻          걻ʱִнű1126걻˫          ˫˫걻˫ʱִнű1126갴ť      󰴡󰴡갴ťʱִнű1126ƶ            ơơָƶʱִнű1126Ƴ            ָƳĳԪʱִнű1126ͣ            ָͣĳԪ֮ʱִнű1126갴ťɿ      ɡɡ갴ťɿʱִнű1126ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>9786               66 1154                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1154ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1154ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1154ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1154Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1154Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1154tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1154ĵ          ĵʱִнű1154ĵж          ж¡ж¡ĵжʱִнű1154Ԫظı            ııԪظıʱִнű1154ύ          ύύύʱִнű1154          ááʱִнű1154Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1154Ԫʧȥ        ʧʧԪʧȥʱִнű1154Ԫػý        ýýԪػýʱִнű1154ͼж        ضϡضϡͼжʱִнű1154̱          ̱ʱִнű1154ºɿ        ɡɡ̱ºɿʱִнű1154̱ɿ          ɡɡ̱ɿʱִнű1154걻          걻ʱִнű1154걻˫          ˫˫걻˫ʱִнű1154갴ť      󰴡󰴡갴ťʱִнű1154ƶ            ơơָƶʱִнű1154Ƴ            ָƳĳԪʱִнű1154ͣ            ָͣĳԪ֮ʱִнű1154갴ťɿ      ɡɡ갴ťɿʱִнű1154ˮƽ      HTML <h1> - <h6> ǩ align 
HTML <h1> - <h6> ǩ
÷
align Թ涨ˮƽ뷽ʽ
ʵ
ж HTML ⣺
<h1 align="center">This is heading 1</h1>978                ΡΡHTML <p> ǩ
÷
<p> ǩ䡣

p ԪػԶǰ󴴽һЩհסԶЩռ䣬Ҳʽй涨
1182                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1182ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1182ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1182ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1182Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1182Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1182tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1182ĵ          ĵʱִнű1182ĵж          ж¡ж¡ĵжʱִнű1182Ԫظı            ııԪظıʱִнű1182ύ          ύύύʱִнű1182          ááʱִнű1182Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1182Ԫʧȥ        ʧʧԪʧȥʱִнű1182Ԫػý        ýýԪػýʱִнű1182ͼж        ضϡضϡͼжʱִнű1182̱          ̱ʱִнű1182ºɿ        ɡɡ̱ºɿʱִнű1182̱ɿ          ɡɡ̱ɿʱִнű1182걻          걻ʱִнű1182걻˫          ˫˫걻˫ʱִнű1182갴ť      󰴡󰴡갴ťʱִнű1182ƶ            ơơָƶʱִнű1182Ƴ            ָƳĳԪʱִнű1182ͣ            ָͣĳԪ֮ʱִнű1182갴ťɿ      ɡɡ갴ťɿʱִнű1182ıĶ    HTML <p> ǩ align 
HTML <p> ǩ
÷
align Թ涨ıĶ뷽ʽ
ʵ
ҶĶ䣺
<p align="right">This is some text in a very short paragraph</p>978з              ββHTML <br> ǩ
÷
<br> ɲһ򵥵Ļз

<br> ǩǿձǩζûнǩǴģ<br></br> XHTML УѽǩڿʼǩУҲ <br />

ע⣬<br> ǩֻǼ򵥵ؿʼµһУ <p> ǩʱͨڵĶ֮һЩֱļࡣ
978ˮƽ              ߡߡHTML <hr> ǩ
÷
<hr> ǩ HTML ҳдһˮƽߡ

ˮƽָߣhorizontal ruleӾϽĵָɸ֡
1211                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1211ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1211ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1211ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1211Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1211Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1211tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1211ĵ          ĵʱִнű1211ĵж          ж¡ж¡ĵжʱִнű1211Ԫظı            ııԪظıʱִнű1211ύ          ύύύʱִнű1211          ááʱִнű1211Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1211Ԫʧȥ        ʧʧԪʧȥʱִнű1211Ԫػý        ýýԪػýʱִнű1211ͼж        ضϡضϡͼжʱִнű1211̱          ̱ʱִнű1211ºɿ        ɡɡ̱ºɿʱִнű1211̱ɿ          ɡɡ̱ɿʱִнű1211걻          걻ʱִнű1211걻˫          ˫˫걻˫ʱִнű1211갴ť      󰴡󰴡갴ťʱִнű1211ƶ            ơơָƶʱִнű1211Ƴ            ָƳĳԪʱִнű1211ͣ            ָͣĳԪ֮ʱִнű1211갴ťɿ      ɡɡ갴ťɿʱִнű1211ˮƽߵˮƽ    HTML <hr> ǩ align 
HTML <hr> ǩ
÷
align Թ涨ˮƽߵˮƽ뷽ʽ
עͣ width ΪС 100% align ԲκЧ
ʵ
жˮƽߣ
<hr align="center" width="50%" />1211ɫΪɫ          HTML <hr> ǩ noshade 
HTML <hr> ǩ
÷
noshade Թ涨ˮƽߵɫΪɫӰɫ
ʵ
ûӰЧˮƽߣ
<hr noshade="noshade" />1211ˮƽߵĸ߶        ߴߴHTML <hr> ǩ size 
HTML <hr> ǩ
÷
size Թ涨ˮƽߵĸ߶ȣؼơ
ʵ
߶Ϊ 50 صˮƽߣ
<hr size="50" />1211ˮƽߵĿ        HTML <hr> ǩ width 
HTML <hr> ǩ
÷
width Թ涨ˮƽߵĿȣؼƻٷֱȼơ
ʵ
Ϊ 50% ˮƽߣ
<hr width="50%" />978ı            ֡֡÷
µԪؾʽԪءǲʹЩǩֻϣͨЩǩظııʽʹʽȡøӷḻЧ

978                ֡֡HTML <font> ǩ
÷
<font> 涨ı塢ߴ硢ɫ
1243                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1243ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1243ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1243ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1243Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1243Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1243tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1243ĵ          ĵʱִнű1243ĵж          ж¡ж¡ĵжʱִнű1243Ԫظı            ııԪظıʱִнű1243ύ          ύύύʱִнű1243          ááʱִнű1243Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1243Ԫʧȥ        ʧʧԪʧȥʱִнű1243Ԫػý        ýýԪػýʱִнű1243ͼж        ضϡضϡͼжʱִнű1243̱          ̱ʱִнű1243ºɿ        ɡɡ̱ºɿʱִнű1243̱ɿ          ɡɡ̱ɿʱִнű1243걻          걻ʱִнű1243걻˫          ˫˫걻˫ʱִнű1243갴ť      󰴡󰴡갴ťʱִнű1243ƶ            ơơָƶʱִнű1243Ƴ            ָƳĳԪʱִнű1243ͣ            ָͣĳԪ֮ʱִнű1243갴ťɿ      ɡɡ갴ťɿʱִнű1243ıɫ          ɫɫHTML <font> ǩ color 
HTML <font> ǩ
÷
color Թ涨 font Ԫıɫ
ʵ
涨ıɫ
<font color="red">This is some text!</font>1243ı          HTML <font> ǩ face 
HTML <font> ǩ
÷
face Թ涨 font Ԫı塣
ʵ
涨ı壺
<font face="verdana">This is some text!</font>1243ߴС            ߴߴHTML <font> ǩ size 
HTML <font> ǩ
÷
size Թ涨 font ԪıĳߴС
ʵ
涨ıĴС
<font size="5">This is some text!</font>
TIY
֧
֧ size ԡ978бı            бб 978ǿı            ǿǿ÷
ԪضǶԪءȻЩǩıֳʽʵϣЩǩӵȷе塣

ǲʹǣֻΪ˴ﵽĳӾЧʹЩǩĻǽʹʽôﵽӷḻЧ

978ı            ÷
µԪؾʽԪءǲʹЩǩֻϣͨЩǩظııʽʹʽȡøӷḻЧ

978ǿǿı        ǿǿǿǿ÷
ԪضǶԪءȻЩǩıֳʽʵϣЩǩӵȷе塣

ǲʹǣֻΪ˴ﵽĳӾЧʹЩǩĻǽʹʽôﵽӷḻЧ

978Сı            СС÷
µԪؾʽԪءǲʹЩǩֻϣͨЩǩظııʽʹʽȡøӷḻЧ

978ϱı            ϱϱHTML <sup> ǩ
÷
<sup> ǩɶϱı

 <sup> ǩǩ </sup> еݽԵǰıַ߶ȵһʾ뵱ǰıֵֺŶһġ

ʾǩĵӽעԼʾʽеֵָʱǳá <a> ǩʹãͿԴܺõĳӽע
978±ı            ±±HTML <sub> ǩ
÷
<sub> ǩɶ±ı

 <sub> ǩǩ </sub> еݽԵǰıַ߶ȵһʾ뵱ǰıֵֺŶһġ

ʾ <sub> ǩǺӦ <sup> ǩѧʽѧźͻѧʽжǳá
978ı            ķķHTML <bdo> ǩ
÷
bdo ԪؿɸĬϵı
1280                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1280ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1280ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1280ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1280Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1280Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1280tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1280ĵ          ĵʱִнű1280ĵж          ж¡ж¡ĵжʱִнű1280Ԫظı            ııԪظıʱִнű1280ύ          ύύύʱִнű1280          ááʱִнű1280Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1280Ԫʧȥ        ʧʧԪʧȥʱִнű1280Ԫػý        ýýԪػýʱִнű1280ͼж        ضϡضϡͼжʱִнű1280̱          ̱ʱִнű1280ºɿ        ɡɡ̱ºɿʱִнű1280̱ɿ          ɡɡ̱ɿʱִнű1280걻          걻ʱִнű1280걻˫          ˫˫걻˫ʱִнű1280갴ť      󰴡󰴡갴ťʱִнű1280ƶ            ơơָƶʱִнű1280Ƴ            ָƳĳԪʱִнű1280ͣ            ָͣĳԪ֮ʱִнű1280갴ťɿ      ɡɡ갴ťɿʱִнű1280ı            ѡ
DTD ָʾ DTD ʹáS=Strict, T=Transitional, F=Frameset.
	ֵ		DTD
dir	
ltr
rtl
ֵķ	STF
978»ı          »ߡ»ߡHTML <u> ǩ
÷
<u> ǩɶ»ı
978Ԥʽı          ԤʽԤʽHTML <pre> ǩ
÷
pre ԪؿɶԤʽıΧ pre ԪеıͨᱣոͻзıҲΪȿ塣

<pre> ǩһӦþʾԴ롣

Ե¶Ͽıǩ⡢<p>  <address> ǩܰ <pre> ĿЩѶǩΪ򵥵ػУΪϲһġ

pre Ԫı԰ʽͻݵʽ仯ӡͼˮƽָߡǩ <a> ǩŵ <pre> ʱ HTML/XHTML ĵһɡ뿴ӣ

1309                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1309ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1309ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1309ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1309Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1309Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1309tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1309ĵ          ĵʱִнű1309ĵж          ж¡ж¡ĵжʱִнű1309Ԫظı            ııԪظıʱִнű1309ύ          ύύύʱִнű1309          ááʱִнű1309Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1309Ԫʧȥ        ʧʧԪʧȥʱִнű1309Ԫػý        ýýԪػýʱִнű1309ͼж        ضϡضϡͼжʱִнű1309̱          ̱ʱִнű1309ºɿ        ɡɡ̱ºɿʱִнű1309̱ɿ          ɡɡ̱ɿʱִнű1309걻          걻ʱִнű1309걻˫          ˫˫걻˫ʱִнű1309갴ť      󰴡󰴡갴ťʱִнű1309ƶ            ơơָƶʱִнű1309Ƴ            ָƳĳԪʱִнű1309ͣ            ָͣĳԪ֮ʱִнű1309갴ťɿ      ɡɡ갴ťɿʱִнű1309ÿеַ    ѡ
	ֵ		DTD
width	number	ÿеַͨ 4080  132	TF978ı      ġġ÷
ԪضǶԪءȻЩǩıֳʽʵϣЩǩӵȷе塣

ǲʹǣֻΪ˴ﵽĳӾЧʹЩǩĻǽʹʽôﵽӷḻЧ

978ֻı          ֡֡ƴֻߵȿıЧ978ı            ̡̡ıʾıǴӼϼġصĵֲС978ı        Խ˱ǩ <pre>  <code> ǩʹá978Ŀ            һĿ978      ı978Ԥʽı          ԤġԤġ޳ʹáԤʽı978ֻȡĸд      ĸĸHTML <acronym> ǩ
÷
<acronym> Ԫؿɶֻȡĸд "NATO"ֻͨȡĸдбǣܹΪƴд򡢷ϵͳԼֶṩõϢ
978д                ддHTML <abbr> ǩ
÷
ʾһдʽ "Inc.""etc."ͨдбǣܹΪƴд򡢷ϵͳԼֶṩõϢ

<abbr> ǩ HTML 4.0 ģʾıһĵʻдʽ

ܻϢıЩıʾʽı档Ҳǰе <abbr> ǩаıûκδʽ޷Ԥ⽫İ汾ʵָñǩ
978ϵϢ            ַַHTML <address> ǩ
÷
<address> ɶһַʼַӦʹַǩĵݡ

۴ĵǼ̶Ҫ߳ӦȷÿĵһַΪṩ˷ĵĿŶȡ
978              HTML <blockquote> ǩ
÷
<blockquote> ǩá

<blockquote>  </blockquote> ֮ıӳıз߽߾ࣩʱʹб塣Ҳ˵ӵԼĿռ䡣
1347                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1347ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1347ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1347ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1347Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1347Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1347tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1347ĵ          ĵʱִнű1347ĵж          ж¡ж¡ĵжʱִнű1347Ԫظı            ııԪظıʱִнű1347ύ          ύύύʱִнű1347          ááʱִнű1347Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1347Ԫʧȥ        ʧʧԪʧȥʱִнű1347Ԫػý        ýýԪػýʱִнű1347ͼж        ضϡضϡͼжʱִнű1347̱          ̱ʱִнű1347ºɿ        ɡɡ̱ºɿʱִнű1347̱ɿ          ɡɡ̱ɿʱִнű1347걻          걻ʱִнű1347걻˫          ˫˫걻˫ʱִнű1347갴ť      󰴡󰴡갴ťʱִнű1347ƶ            ơơָƶʱִнű1347Ƴ            ָƳĳԪʱִнű1347ͣ            ָͣĳԪ֮ʱִнű1347갴ťɿ      ɡɡ갴ťɿʱִнű1347õԴ          ԴԴHTML <blockquote> cite 
HTML <blockquote> ǩ
÷
cite Թ涨õԴ

Եֵһвָĵ URLԼпܵĻڸĵеȷλá
ʵ
 blockquote Ԫе cite ָõԴ

<blockquote cite="http://www.wwf.org">
WWF's ultimate goal is to build a future where people live in harmony with nature.
</blockquote>
978ı            ССHTML <center> ǩ
÷
ıˮƽС
HTML  XHTML ֮Ĳ
 HTML 4.01 Уcenter Ԫز޳ʹá

 XHTML 1.0 Strict DTD Уcenter Ԫز֧֡
ʾעͣ
עͣʾʹ CSS ʽı
978̵            HTML <q> ǩ
÷
<q> ǩ̵á

õΧš
1376                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1376ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1376ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1376ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1376Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1376Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1376tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1376ĵ          ĵʱִнű1376ĵж          ж¡ж¡ĵжʱִнű1376Ԫظı            ııԪظıʱִнű1376ύ          ύύύʱִнű1376          ááʱִнű1376Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1376Ԫʧȥ        ʧʧԪʧȥʱִнű1376Ԫػý        ýýԪػýʱִнű1376ͼж        ضϡضϡͼжʱִнű1376̱          ̱ʱִнű1376ºɿ        ɡɡ̱ºɿʱִнű1376̱ɿ          ɡɡ̱ɿʱִнű1376걻          걻ʱִнű1376걻˫          ˫˫걻˫ʱִнű1376갴ť      󰴡󰴡갴ťʱִнű1376ƶ            ơơָƶʱִнű1376Ƴ            ָƳĳԪʱִнű1376ͣ            ָͣĳԪ֮ʱִнű1376갴ťɿ      ɡɡ갴ťɿʱִнű1376õԴ          ԴԴHTML <q> cite 
HTML <q> ǩ
÷
cite Թ涨õԴ

Եֵһвָĵ URLԼпܵĻڸĵеȷλá
ʵ
 q Ԫе cite ָõԴ

<p>WWF's goal is to:
<q cite="http://www.wwf.org">
build a future where people live in harmony with nature
</q> we hope they succeed.</p>
һ
978                ԴԴáʹøñǩԲο׵ýж壬鼮־ı⡣978ı          HTML <ins> ǩ
÷
<ins> ǩѾĵеı
1405                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1405ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1405ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1405ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1405Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1405Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1405tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1405ĵ          ĵʱִнű1405ĵж          ж¡ж¡ĵжʱִнű1405Ԫظı            ııԪظıʱִнű1405ύ          ύύύʱִнű1405          ááʱִнű1405Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1405Ԫʧȥ        ʧʧԪʧȥʱִнű1405Ԫػý        ýýԪػýʱִнű1405ͼж        ضϡضϡͼжʱִнű1405̱          ̱ʱִнű1405ºɿ        ɡɡ̱ºɿʱִнű1405̱ɿ          ɡɡ̱ɿʱִнű1405걻          걻ʱִнű1405걻˫          ˫˫걻˫ʱִнű1405갴ť      󰴡󰴡갴ťʱִнű1405ƶ            ơơָƶʱִнű1405Ƴ            ָƳĳԪʱִнű1405ͣ            ָͣĳԪ֮ʱִнű1405갴ťɿ      ɡɡ갴ťɿʱִнű1405ָĵ            ԴԴHTML <ins> ǩ cite 
HTML <ins> ǩ
÷
cite ָһĵ URLĵı޸ĵԭ
ʵ
 ins Ԫʹ cite ԣ

<p>My favorite color is <del>blue</del> <ins cite="why_inserted.htm">red</ins>!</p>1405涨ںʱ      ʱʱHTML <ins> ǩ datetime 
HTML <ins> ǩ
÷
datetime Թ涨ı޸ĵںʱ䡣
ʵ
 ins Ԫʹ datetime ԣ

<p>My favorite color is <del>blue</del> 
<ins datetime="2009-08-08T21:55:06Z">red</ins>!</p>TIY
978ɾı          ɾɾHTML <del> ǩ
÷
ĵѱɾı
1434                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1434ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1434ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1434ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1434Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1434Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1434tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1434ĵ          ĵʱִнű1434ĵж          ж¡ж¡ĵжʱִнű1434Ԫظı            ııԪظıʱִнű1434ύ          ύύύʱִнű1434          ááʱִнű1434Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1434Ԫʧȥ        ʧʧԪʧȥʱִнű1434Ԫػý        ýýԪػýʱִнű1434ͼж        ضϡضϡͼжʱִнű1434̱          ̱ʱִнű1434ºɿ        ɡɡ̱ºɿʱִнű1434̱ɿ          ɡɡ̱ɿʱִнű1434걻          걻ʱִнű1434걻˫          ˫˫걻˫ʱִнű1434갴ť      󰴡󰴡갴ťʱִнű1434ƶ            ơơָƶʱִнű1434Ƴ            ָƳĳԪʱִнű1434ͣ            ָͣĳԪ֮ʱִнű1434갴ťɿ      ɡɡ갴ťɿʱִнű1434ָĵ            ԴԴHTML <del> ǩ cite 
HTML <del> ǩ
÷
cite ָһĵ URLĵıɾԭ
ʵ
 del Ԫʹ cite ԣ

a dozen is <del cite="why_deleted.htm">20</del> 12 pieces1434涨ںʱ      ʱʱHTML <del> ǩ datetime 
HTML <del> ǩ
÷
datetime Թ涨ıɾںʱ䡣
ʵ
 del Ԫʹ datetime ԣ

a dozen is <del datetime="2009-08-08T21:55:06Z">20</del> 12 piecesһ
978ɾı        ɾߡɾߡHTML <strike> ǩ
÷
<strike> ǩɶɾı塣
978ɾı        ɾߡɾߡHTML <strike> ǩ
÷
<strike> ǩɶɾı塣
978ê                  êêHTML <a> ǩ
÷
<a> ǩɶêê (anchor) ÷

?ͨʹ href ԣָһĵӣӣ
?ͨʹ name  id ԣһĵڲǩҲ˵ԴָĵƬεӣ
<a> ԪҪ href ԣָӵĿꡣ

УӵĬǣ

?δʵӴ»߶ɫ
?ѱʵӴ»߶ɫ
?Ӵ»߶Ǻɫ
ʾѾע⵽ˣW3School վڵĬϵ۷ǳͬʹ CSS α ıӸӶʽ
1465                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1465ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1465ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1465ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1465Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1465Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1465tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1465ĵ          ĵʱִнű1465ĵж          ж¡ж¡ĵжʱִнű1465Ԫظı            ııԪظıʱִнű1465ύ          ύύύʱִнű1465          ááʱִнű1465Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1465Ԫʧȥ        ʧʧԪʧȥʱִнű1465Ԫػý        ýýԪػýʱִнű1465ͼж        ضϡضϡͼжʱִнű1465̱          ̱ʱִнű1465ºɿ        ɡɡ̱ºɿʱִнű1465̱ɿ          ɡɡ̱ɿʱִнű1465걻          걻ʱִнű1465걻˫          ˫˫걻˫ʱִнű1465갴ť      󰴡󰴡갴ťʱִнű1465ƶ            ơơָƶʱִнű1465Ƴ            ָƳĳԪʱִнű1465ͣ            ָͣĳԪ֮ʱִнű1465갴ťɿ      ɡɡ갴ťɿʱִнű1465ַ            HTML <a> ǩ charset 
HTML <a> ǩ
÷
<a> ǩ charset ָΪĿĵʹõַ롣

charset ԵֵǱ׼ַƣ "UTF-8"Ĭֵ "ISO-8859-1"
ʵ
<a charset="gb2312" href="http://www.w3school.com.cn">www.W3School.com.cn</a>1465ӵ          HTML <a> ǩ coords 
HTML <a> ǩ
÷
coords  shape ϣԹ涨 object  img Ԫӵĳߴ硢״λá

עͣϽǵ 0,0

ʾ贴ܹеͼӳ䣬ʹ area Ԫء
ʵ
<object data="planets.gif" alt="Planets" type="image/gif" usemap="#Map1">
  <map name="Map1">
  <a href="sun.htm" shape="rect" coords="0,0,110,260">Sun</a>
  <a href="mercur.htm" shape="circle" coords="129,161,10">Mercury</a>
  <a href="venus.htm" shape="circle" coords="180,139,14">Venus</a>
  </map>
</object>
1465Ŀ URL          ĿĿHTML <a> ǩ href 
HTML <a> ǩ
÷
<a> ǩ href ָĿ URL

href ԵֵκЧĵԻ URLƬαʶ JavaScript Ρûѡ <a> ǩеݣô᳢Լʾ href ָ URL ʾĵִ JavaScript ʽͺб
ʵ
href Թ涨ӵĿ꣺

<a href="http://www.w3school.com.cn">W3School</a>TIY
ʾע
ע⣺<a> ǩбṩ href Ի name ԡ
ı
һĵļ <a> ǩʽ

<a href="http://www.w3school.com.cn/index.html">W3School ߽̳</a>ЧʾW3School ̡߽̳ͨǴ»ߵɫıûͻ֪һӵĵĳӡ

W3School ߽̳

ûеѡԼָıɫǰӺıɫ

ʾʹ CSS αıӸӶʽ
ͼ
ӵê԰ͼ LOGO һͼӣͼ񣬿Է W3school ҳ

<a href="http://www.w3school.com.cn/index.html">
<img src="/i/w3school_logo_white.gif" />
</a>ĴΪ W3School  LOGO һҳĳӣ

 
ͼΪêһֵͼΧı߿ͨ <img> ǩаͼ border Ϊ 0 ɾӵı߿Ҳʹ CSS ı߿ȫԵظıԪصı߿ʽ
﷨
<a href="value">ֵ
ֵ  
URL ӵ URLֵܵ 
? URL - ָһվ㣨 href="http://www.example.com/index.htm"
? URL - ָվڵĳļhref="index.htm"
?ê URL - ָҳеêhref="#top"
 
1465ĵ    ԡԡHTML <a> ǩ hreflang 
HTML <a> ǩ
÷
<a> ǩ hreflang ָĵԡ

ʹ href ʱſָ hreflang ԡ lang ƣhreflang ԵֵҲ ISO ׼˫ַԴ롣 lang Բͬǣhreflang Բָǩеʹõԣָ href Եõĵʹõԡ
ʵ
hreflang="zh"  w3school һվ

<a href="http://www.w3school.com.cn" hreflang="zh">W3School</a>TIY
֧
֧ hreflang ԡ
﷨
<a hreflang="value">ֵ
ֵ  
language_code ˫ַԴ룬ָĵԡ

鿴пõԴ룬ǵ Դ뼯οֲᡣ
 
1465ê            HTML <a> ǩ name 
HTML <a> ǩ
÷
name ָêanchorơ

name ԿԴͣĵڵǩ

<a> ǩڱṩ href  name ԡ

Ķʹ name Ի id 
ʵ
ͨ name ԣǿһĿ¼б

<a href="#C1">һ</a>
<a href="#C2">ڶ</a>
<a href="#C3"></a>
<a href="#C3"></a>
...
һ
֧
֧ name ԡ
﷨
<a name="value">ֵ
ֵ  
anchor_name êơ 
Ķʹ name Ի id ԣ
 HTML 4.0 ֮ǰİ汾Уֻʹ <a> ǩ name ԲܴƬαʶ HTML 4.0  id Եĳ֣ HTML  XHTML ԪضƬαʶΪ id ʶеıǩС<a> ǩΪܹǰİ汾ݶ name ԣͬʱҲʹ id ԡЩԿ໥ʹã԰ id Կ name Ե汾name  id Զ href Խʹãһ <a> ǩͿͬʱΪӺƬαʶʹá

Լ򵥵ؽƬαʶǶձʹõ goto ǩ HTML ģ⡣<a> ǩе name Ի <a> ǩе id Իĵзһʶǩӵĵʱ͵ڸҪתgotoñʶ

id  name ԵֵκַַΨһıǣͬһĵе name  id ظʹãǿڲͬĵٴʹá

1465ǰĵ뱻ĵĹϵϵϵHTML <a> ǩ rel 
HTML <a> ǩ
÷
<a> ǩ rel ָǰĵ뱻ĵĹϵ

 <a> ǩĿѡ rel  rev ֱʾԴĵĿĵ֮ʽĹϵͷrel ָԴĵĿĵĹϵ rev ָĿĵԴĵĹϵԿ <a> ǩͬʱʹá

rel  rev ԵֵԿոָĹϵбʵʵĹϵǵĺȡԼHTML  XHTML ׼ûʽԡ磬һϵĵеĳĵܻаĹϵ

<a href="part_12.html" rel="next" rev="prev">ԴĿĹϵƶһĵĿ굽ԴĹϵǷǰһĵ

ʾҲϣ W3C û͡ĻӦʹ profile ڶ͵ԼøϢ head Ԫص profile ԡ
ʵ
 rel Եӣ

<a rel="friend" href="http://www.w3c.com/">w3c</a>һ
֧
û֧ rel ԡ

עͣȻϽ rel  rev ԸıêݵۡԶĵ˵ҲʹЩӼϡĿ¼ֻмŻЩıӵۡ

ʾκηʽʹøԣøԻøйӵϢ
﷨
<a rel="value">ֵ
ֵ  
alternate ĵĿѡ汾ӡҳҳ񣩡 
stylesheet ĵⲿʽ 
start еĵһĵ 
next еһĵ 
prev еǰһĵ 
contents ĵĿ¼ 
index ĵ 
glossary ĵִʵ͡ 
copyright ȨϢĵ 
chapter ĵ¡ 
section ĵĽڡ 
subsection ĵӶΡ 
appendix ĵ¼ 
help ĵ 
bookmark ĵ 
    
nofollow Google ʹ "nofollow"ָ Google 治Ҫӡ 
licence   
tag   
friend   
1465ǰĵ뱻ĵĹϵϵϵHTML <a> ǩ rev 
HTML <a> ǩ
÷
<a> ǩ rev ָǰĵ뱻ĵĹϵ

 <a> ǩĿѡ rel  rev ֱʾԴĵĿĵ֮ʽĹϵͷrel ָԴĵĿĵĹϵ rev ָĿĵԴĵĹϵԿ <a> ǩͬʱʹá

rel  rev ԵֵԿոָĹϵбʵʵĹϵǵĺȡԼHTML  XHTML ׼ûʽԡ磬һϵĵеĳĵܻаĹϵ

<a href="part_12.html" rel="next" rev="prev">ԴĿĹϵƶһĵĿ굽ԴĹϵǷǰһĵ

ʾҲϣ W3C û͡ĻӦʹ profile ڶ͵ԼøϢ head Ԫص profile ԡ
ʵ
 rev Եӣ

<a rev="friend" href="http://www.w3c.com/">w3c</a>һ
֧
û֧ rev ԡ

עͣȻϽ rel  rev ԸıêݵۡԶĵ˵ҲʹЩӼϡĿ¼ֻмŻЩıӵۡ

ʾκηʽʹøԣøԻøйӵϢ
﷨
<a rev="value">1465ӵ״          ״״HTML <a> ǩ shape 
HTML <a> ǩ
÷
shape  coords ϣԹ涨 object  img Ԫӵĳߴ硢״λá

ʾ贴ܹеͼӳ䣬ʹ area Ԫء
ʵ
<object data="planets.gif" alt="Planets" type="image/gif" usemap="#Map1">
  <map name="Map1">
  <a href="sun.htm" shape="rect" coords="0,0,110,260">Sun</a>
  <a href="mercur.htm" shape="circle" coords="129,161,10">Mercury</a>
  <a href="venus.htm" shape="circle" coords="180,139,14">Venus</a>
  </map>
</object>
һ
֧
ֻ Firefox  Opera ֧ shape ԡ
﷨
<a shape="value">ֵ
ֵ  
default 涨ȫ 
rect  
circle ԲΡ 
poly  
1465ںδ          δδHTML <a> ǩ target 
HTML <a> ǩ
÷
<a> ǩ target Թ涨ںδĵ

һ <a> ǩڰһ target ԣʾǩ href ġĿǺϵĿܻߴеĵָƻ id ĿܻߴڲڣһµĴڣһָıǣȻµĵǸڡӴԺ󣬳ĵͿָµĴڡ

´
ָĳʹôЧ߱úס磬һ򵥵ĵбԽĵضһĴڣ

<h3>Table of Contents</h3>
<ul>
  <li><a href="pref.html" target="view_window">Preface</a></li>
  <li><a href="chap1.html" target="view_window">Chapter 1</a></li>
  <li><a href="chap2.html" target="view_window">Chapter 2</a></li>
  <li><a href="chap3.html" target="view_window">Chapter 3</a></li>
</ul>
һ

ûһѡбеĳʱһµĴڣΪ "view_window"Ȼʾϣʾĵݡûбѡһӣ "view_window" Դڴ״̬ͻٴνѡĵǸڣȡղŵЩĵ

УбĴûԷʵġͨеһӣʹһڵݷ仯

ڿд򿪴
ôһڣʹ target ͨķһ <frameset> ʾнݶһ߶СԽбһܵĵһУڵĿʾѡĵ

<frameset cols="100,*">
  <frame src="toc.html">
  <frame src="pref.html" name="view_frame">
</frameset> 
һ

ʾܵʱܰĿ¼ұܰǰԡ

 "toc.html" Դ룺

<h3>Table of Contents</h3>
<ul>
  <li><a href="pref.html" target="view_frame">Preface</a></li>
  <li><a href="chap1.html" target="view_frame">Chapter 1</a></li>
  <li><a href="chap2.html" target="view_frame">Chapter 2</a></li>
  <li><a href="chap3.html" target="view_frame">Chapter 3</a></li>
</ul>
ע⣬ĵ "toc.html" УÿӵĿ궼 "view_frame"ҲұߵĿܡ

û߿еĿ¼ѡһʱὫĵ벢ʾұ "view_frame" СӱѡʱұеҲᷢ仯ʼձֲ䡣
Ŀ
 4 Ŀĵض

_blank
һ´򿪡δĴĿĵ

_self
ĿֵûָĿ <a> ǩĬĿ꣬ʹĿĵ벢ʾͬĿܻߴΪԴĵĿǶҲҪģǺĵ <base> ǩе target һʹá

_parent
Ŀʹĵ븸ڻ߰õĿܵĿܼڴڻڶУôĿ _self Ч

_top
ĿʹĵӵĴڣ _top Ŀ꽫бĿܲĵڡ

ʾЩ target  4 ֵ»߿ʼκһ»ΪͷĴڻĿ궼ᱻԣˣҪ»Ϊĵжκο name  id ĵһַ
﷨
<a target="value">ֵ
ֵ  
_blank ´д򿪱ĵ 
_self ĬϡͬĿд򿪱ĵ 
_parent ڸܼд򿪱ĵ 
_top д򿪱ĵ 
framename ָĿд򿪱ĵ 
1465Ŀ URL  MIME ͼ͡͡涨Ŀ URL  MIME ͡978ⲿԴ            ԴԴHTML <link> ǩ
÷
<link> ǩĵⲿԴĹϵ

<link> ǩ;ʽ
ʵ
һⲿʽ

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>
1502                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1502ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1502ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1502ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1502Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1502Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1502tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1502ĵ          ĵʱִнű1502ĵж          ж¡ж¡ĵжʱִнű1502Ԫظı            ııԪظıʱִнű1502ύ          ύύύʱִнű1502          ááʱִнű1502Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1502Ԫʧȥ        ʧʧԪʧȥʱִнű1502Ԫػý        ýýԪػýʱִнű1502ͼж        ضϡضϡͼжʱִнű1502̱          ̱ʱִнű1502ºɿ        ɡɡ̱ºɿʱִнű1502̱ɿ          ɡɡ̱ɿʱִнű1502걻          걻ʱִнű1502걻˫          ˫˫걻˫ʱִнű1502갴ť      󰴡󰴡갴ťʱִнű1502ƶ            ơơָƶʱִнű1502Ƴ            ָƳĳԪʱִнű1502ͣ            ָͣĳԪ֮ʱִнű1502갴ťɿ      ɡɡ갴ťɿʱִнű1502ĵַ  HTML <link> ǩ charset 
HTML <link> ǩ
÷
charset Թ涨ĵַ뷽ʽ

ִĬַ ISO-8859-1
ʵ
Уcharset ָʾĵıдģ

<head>
<link href="domoarigato.htm" rel="parent" charset="ISO-2022-JP" />
</head>
֧
û֧ charset ԡ
﷨
<link charset="value">ֵ
ֵ  
character_set ĵַõַУ

?UTF-8 - Unicode ַ
?ISO-8859-1 - ĸַ
ϣʹκַܹǡĳַʹõķΧԽ㣬Խп

鿴пõַǵ ַοֲᡣ
 
HTML <link> ǩ
1502ĵλ      ĿĿHTML <link> ǩ href 
HTML <link> ǩ
÷
href Թ涨ĵλãURL
ʵ
Уhref ָһⲿʽλã

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>
TIY
ʾע
עͣҪӦöе URL  URL 롣
﷨
<link href="value">ֵ
ֵ  
URL ӵ URLֵܵ

? URL - ָһվ㣨 href="http://www.example.com/theme.css"
? URL - ָվڵĳļhref="/themes/theme.css"
 
1502ĵ      ԡԡHTML <link> ǩ hreflang 
HTML <link> ǩ
÷
hreflang Թ涨ĵıԡ
ʵ
Уhreflang ָʾĵıдģ

<head>
<link href="domoarigato.htm" rel="parent" charset="ISO-2022-JP" hreflang="ja" />
</head>
֧
û֧ hreflang ԡ
﷨
<link hreflang="value">ֵ
ֵ  
language_code ֵΪ˫ĸԴ룬涨ĵԡ

鿴пõԴ룬ǵԴοֲᡣ
 
HTML <link> ǩ
1502ʾ豸            豸豸HTML <link> ǩ media 
HTML <link> ǩ
÷
media Թ涨ĵʾʲô豸ϡ

media Ϊͬý͹涨ͬʽ
ʵ
ֲͬʽֲͬýͣĻʹӡ

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
<link rel="stylesheet" type="text/css" href="print.css" media="print"/>
</head>
TIY
֧
ֵ֧Ϊ "screen""print" Լ "all"  media ԡ

ʾȫģʽУOpera Ҳ֧ "projection" ֵ
﷨
<link media="value">ֵ
ֵ  
screen ĻĬϣ 
tty 紫ֻԼƵʹõȿַý顣 
tv ӻ豸ͷֱʡ޵Ĺ 
projection ӳ 
handheld ֳ豸СĻ޴ 
print ӡԤģʽ/ӡҳ档 
braille ä˵ַ豸 
aural ϳ 
all 豸 
1502ǰ뱻ĵϵϵϵHTML <link> ǩ rel 
HTML <link> ǩ
÷
rel Թ涨ǰĵ뱻ĵ֮Ĺϵ
ʵ
Уrel ָʾӵĵһʽ

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>
TIY
֧
ֻ rel Ե "stylesheet" ֵõֵֻ֧֡õ˲ֵ֧֡
﷨
<link rel="value">ֵ
ֵ  
alternate ĵ汾ӡҳ񣩡 
stylesheet ĵⲿʽ 
start еĵһĵ 
next еһĵ 
prev еһĵ 
contents ĵĿ¼ 
index ĵ 
glossary ĵʹõĴʻͣ 
copyright ȨϢĵ 
chapter ĵ¡ 
section ĵĽڡ 
subsection ĵСڡ 
appendix ĵĸ¼ 
help ĵ 
bookmark ĵ 
1502뵱ǰϵ    ϵϵHTML <link> ǩ rev 
HTML <link> ǩ
÷
rev Թ涨ĵ뵱ǰĵ֮Ĺϵ

rev  rel ෴ġ
ʵ
Уrev ָʾǰĵ "wildcats.htm" ĸҳ棺

<head>
<link rev="parent" href="intro.html" />
</head>
֧
û֧ rev ԡ
﷨
<link rev="value">ֵ
ֵ  
alternate ĵ汾ӡҳ񣩡 
stylesheet ĵⲿʽ 
start еĵһĵ 
next еһĵ 
prev еһĵ 
contents ĵĿ¼ 
index ĵ 
glossary ĵʹõĴʻͣ 
copyright ȨϢĵ 
chapter ĵ¡ 
section ĵĽڡ 
subsection ĵСڡ 
appendix ĵĸ¼ 
help ĵ 
bookmark ĵ 
1502ļĵ        δδHTML <link> ǩ target 
HTML <link> ǩ
÷
target Թ涨ĸڻмرĵ
ʵ
У´мرĵ

<head>
<link rel="parent" href="index.html" target="_blank" />
</head>
֧
û֧ target ԡ
﷨
<link target="value">ֵ
ֵ  
_blank ´д򿪱ĵ 
_self ĬϡͬĿд򿪱ĵ 
_parent ڸܼд򿪱ĵ 
_top д򿪱ĵ 
framename ָĿд򿪱ĵ 
1502 MIME           ͡͡HTML <link> ǩ type 
HTML <link> ǩ
÷
type Թ涨ĵ MIME ͡

 MIME  "text/css"ʽ
ʵ
У´мرĵ

<head>
<link rel="stylesheet" type="text/css" href="theme.css" />
</head>
TIY
﷨
<link type="value">ֵ
ֵ  
MIME_type ĵ MIME ͡ 
978ܼڻ    ܡܡHTML <frame> ǩ
÷
<frame> ǩ frameset еһضĴڣܣ

frameset еÿܶòͬԣ borderscrollingnoresize ȵȡ
1537                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1537ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1537ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1537ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1537Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1537Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1537tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1537ĵ          ĵʱִнű1537ĵж          ж¡ж¡ĵжʱִнű1537Ԫظı            ııԪظıʱִнű1537ύ          ύύύʱִнű1537          ááʱִнű1537Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1537Ԫʧȥ        ʧʧԪʧȥʱִнű1537Ԫػý        ýýԪػýʱִнű1537ͼж        ضϡضϡͼжʱִнű1537̱          ̱ʱִнű1537ºɿ        ɡɡ̱ºɿʱִнű1537̱ɿ          ɡɡ̱ɿʱִнű1537걻          걻ʱִнű1537걻˫          ˫˫걻˫ʱִнű1537갴ť      󰴡󰴡갴ťʱִнű1537ƶ            ơơָƶʱִнű1537Ƴ            ָƳĳԪʱִнű1537ͣ            ָͣĳԪ֮ʱִнű1537갴ťɿ      ɡɡ갴ťɿʱִнű1537Χı߿      ܱ߿ܱ߿HTML <frame> ǩ frameborder 
HTML <frame> ǩ
÷
frameborder Թ涨ǷʾΧı߿

ʾʵԷԭòøԣʹ CSS Ӧñ߿ʽɫ

CSS ʵframe ߿
ʵ
߿˫ҳ棺

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" frameborder="0" />
<frame src="frame_b.htm" frameborder="0" />
</frameset>

</html>
TIY
﷨
<frame frameborder="value">ֵ
ֵ  
1 б߿Ĭֵ 
0 ޱ߿ 
1537ָҳ        ҳҳHTML <frame> ǩ longdesc 
HTML <frame> ǩ
÷
longdesc Թ涨ָһҳ URLҳйؿݵĳ

 longdesc Ե֧ԷǳûбҪʹøԡ

ʾΪĳ frame ṩбҪĻֻҪ򵥵شһָҳӼɣӶκ˶ǿɼģ
ʵ
longdesc ָ˴пݳҳ棺

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" longdesc="w3school.txt" />
<frame src="frame_b.htm" />
</frameset>

</html>
TIY
﷨
<frame longdesc="value">ֵ
ֵ  
URL 涨ܵҳ URL

ֵܵ

? URL - ָվ㣨 src="www.example.com/description.txt"
? URL - ָվڵļ src="description.txt"
 
1537ϱ߾±߾      ±߾±߾HTML <frame> ǩ marginheight 
HTML <frame> ǩ
÷
marginheight Թ涨ܵϷ·֮ĸ߶ȣؼơ
ʵ
һܵϱ߾±߾ 50 أڶܵϱ߾±߾ 0

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" marginheight="50" />
<frame src="frame_b.htm" marginheight="0" />
</frameset>

</html>
TIY
﷨
<frame marginheight="value">ֵ
ֵ  
pixels 涨ܵϱ߾±߾ࡣ 
1537߾ұ߾      ұ߾ұ߾HTML <frame> ǩ marginwidth 
HTML <frame> ǩ
÷
marginwidth Թ涨ܵҲ֮ĸ߶ȣؼơ
ʵ
һܵ߾ұ߾ 50 أڶܵϱ߾±߾ 0

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" marginwidth="50" />
<frame src="frame_b.htm" marginwidth="0" />
</frameset>

</html>
TIY
﷨
<frame marginwidth="value">ֵ
ֵ  
pixels 涨ܵ߾ұ߾ࡣ 
1537ܵ          HTML <frame> ǩ name 
HTML <frame> ǩ
÷
name Թ涨ܵơ

frame Ԫص name  JavaScript ԪأΪӵĿꡣ
ʵ
Ŀܣ

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" name="frame_a" />
<frame src="frame_b.htm" />
</frameset>

</html>
TIY
﷨
<frame name="value">ֵ
ֵ  
name ܵơ 
1537̶ܴС        ̶ߴ̶ߴHTML <frame> ǩ noresize 
HTML <frame> ǩ
÷
noresize Թ涨û޷ܵĴС

Ĭϵأͨ϶֮ġǽڡıܵĴСԿܵĴС
ʵ
޷СĿܣ

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" noresize="noresize" />
<frame src="frame_b.htm" />
</frameset>

</html>
TIY
﷨
<frame noresize="noresize">ֵ
ֵ  
noresize û޷ܵĴС 
HTML <frame> ǩ
1537              HTML <frame> ǩ scrolling 
HTML <frame> ǩ
÷
scrolling Թ涨Ƿڿʾ

Ĭϵأݴڿܣͻֹ
ʵ
ʾĿܣ

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" scrolling="yes" />
<frame src="frame_b.htm" />
</frameset>

</html>
TIY
﷨
<frame scrolling="value">ֵ
ֵ  
auto Ҫʱʾ 
yes ʼʾʹҪ 
no ӲʾʹҪ 
1537ĵURL       ··HTML <frame> ǩ src 
HTML <frame> ǩ
÷
src Թ涨ڿʾĵ URL
ʵ
src Թ涨ڿʾĵλã

<html>

<frameset cols="50%,50%">
<frame src="frame_a.htm" />
<frame src="frame_b.htm" />
</frameset>

</html>
TIY
﷨
<frame src="value">ֵ
ֵ  
URL 涨Ҫڿʾĵĵַ

ֵܵ

? URL - ָվ㣨 src="www.example.com/index.html"
? URL - ָվڵļ src="index.html"
 
978ܼ              ܼܼHTML <frameset> ǩ
÷
frameset Ԫؿɶһܼ֯ڣܣÿܴжĵ򵥵ӦУframeset Ԫؽ涨ڿܼдڶлСʹ cols  rows ԡ
ʵ
򵥵ҳ棺

<html>

<frameset cols="25%,50%,25%">
  <frame src="frame_a.htm" />
  <frame src="frame_b.htm" />
  <frame src="frame_c.htm" />
</frameset>

</html>
1572                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1572ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1572ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1572ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1572Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1572Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1572tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1572ĵ          ĵʱִнű1572ĵж          ж¡ж¡ĵжʱִнű1572Ԫظı            ııԪظıʱִнű1572ύ          ύύύʱִнű1572          ááʱִнű1572Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1572Ԫʧȥ        ʧʧԪʧȥʱִнű1572Ԫػý        ýýԪػýʱִнű1572ͼж        ضϡضϡͼжʱִнű1572̱          ̱ʱִнű1572ºɿ        ɡɡ̱ºɿʱִнű1572̱ɿ          ɡɡ̱ɿʱִнű1572걻          걻ʱִнű1572걻˫          ˫˫걻˫ʱִнű1572갴ť      󰴡󰴡갴ťʱִнű1572ƶ            ơơָƶʱִнű1572Ƴ            ָƳĳԪʱִнű1572ͣ            ָͣĳԪ֮ʱִнű1572갴ťɿ      ɡɡ갴ťɿʱִнű1572п              ССHTML <frameset> ǩ cols Ժ rows 
ú÷
<frameset> ǩһԣҪô rowsҪô colsȡѡǶĵпܻǶ׵ĿܼлеĴСĿ

ԶöŷֵֿбЩֵָ˿ܵľԣص㣩ԣٷֱȻռ䣩ȣжԣ߾ԻԸ߶ȣжԣЩֵĿĵʾлеĿܡ

һʾʱᾡܽӽĿܼߴ硣ǣΪܹ³صĿܼչĵڵı߽磬ҲָĿûʱÿհڡ෴һкܵĴСռ䣬ܹĵˡע⵽һĵûй𣿣

 1
Ĵ뽫 3 пܣ

<frameset rows="150,300,150">еÿжᴩĵڡһһܱΪ 150 ظߣڶó 300 ظߡ

ʵϣ 600 ظߣԶձѹһһܣʹܶռ 1/4 Ĵڿռ䡣мнռʣ 1/2 Ĵڿռ䡣

 2
ôڳߴİٷֱȱʾĿкгߴݸʵʡ

磬ʾղǸʾЧͬ

<frameset rows="25%,50%,25%">ȻЩٷֱȼ 100%ҲԶձ¸ÿгߴ졣

 3
һôۺͲһ¡еĿԱΪͬѶеգͽΪʲôҪ <frameset>  rows  cols ֵϼǺšҪڽڵĿܷܼ֮󣬸ʣµĿռԵлС

磬пܱǩʱ

<frameset cols="100, *">ӻһΪ̶ 100 صУȻһУлռݿܼеĿռ䡣

 4
ԶԶлֵʹǺš£ӦлнԿÿռеȷ֣磺

<frameset rows="*, 100, *">ڿܼмһ 100 ظߵУеϱߺ±߸һͬߴС

 5
ǺǰһֵӦлоͻԵػøĿÿռ䡣磺

<frameset cols="10%, 3*, *, *"> 4 Уһռܼȵ 10%Ȼռ 3/5 ڶܣ͵ĸܸռ 1/5

ӿԷ֣ʹǺţֵΪǰ׺Ժ׵һܼзָʣµĿռ䡣
ʾע
ʾҪעǣûֶΪĵлȷС˸ıÿڿʾиռݵԱʽظҪΪ˷ֹ <frame> ǩʹ noresize ԡ
1572п              ССHTML <frameset> ǩ cols Ժ rows 
ú÷
<frameset> ǩһԣҪô rowsҪô colsȡѡǶĵпܻǶ׵ĿܼлеĴСĿ

ԶöŷֵֿбЩֵָ˿ܵľԣص㣩ԣٷֱȻռ䣩ȣжԣ߾ԻԸ߶ȣжԣЩֵĿĵʾлеĿܡ

һʾʱᾡܽӽĿܼߴ硣ǣΪܹ³صĿܼչĵڵı߽磬ҲָĿûʱÿհڡ෴һкܵĴСռ䣬ܹĵˡע⵽һĵûй𣿣

 1
Ĵ뽫 3 пܣ

<frameset rows="150,300,150">еÿжᴩĵڡһһܱΪ 150 ظߣڶó 300 ظߡ

ʵϣ 600 ظߣԶձѹһһܣʹܶռ 1/4 Ĵڿռ䡣мнռʣ 1/2 Ĵڿռ䡣

 2
ôڳߴİٷֱȱʾĿкгߴݸʵʡ

磬ʾղǸʾЧͬ

<frameset rows="25%,50%,25%">ȻЩٷֱȼ 100%ҲԶձ¸ÿгߴ졣

 3
һôۺͲһ¡еĿԱΪͬѶеգͽΪʲôҪ <frameset>  rows  cols ֵϼǺšҪڽڵĿܷܼ֮󣬸ʣµĿռԵлС

磬пܱǩʱ

<frameset cols="100, *">ӻһΪ̶ 100 صУȻһУлռݿܼеĿռ䡣

 4
ԶԶлֵʹǺš£ӦлнԿÿռеȷ֣磺

<frameset rows="*, 100, *">ڿܼмһ 100 ظߵУеϱߺ±߸һͬߴС

 5
ǺǰһֵӦлоͻԵػøĿÿռ䡣磺

<frameset cols="10%, 3*, *, *"> 4 Уһռܼȵ 10%Ȼռ 3/5 ڶܣ͵ĸܸռ 1/5

ӿԷ֣ʹǺţֵΪǰ׺Ժ׵һܼзָʣµĿռ䡣
ʾע
ʾҪעǣûֶΪĵлȷС˸ıÿڿʾиռݵԱʽظҪΪ˷ֹ <frame> ǩʹ noresize ԡ
978Բֿ֧ݼܡܡHTML <noframes> ǩ
÷
noframes ԪؿΪЩֿ֧ܵʾınoframes Ԫλ frameset Ԫڲ
978            ڿܡڿܡHTML <iframe> ǩ
÷
iframe Ԫػᴴһĵܣڿܣ
1602                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1602ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1602ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1602ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1602Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1602Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1602tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1602ĵ          ĵʱִнű1602ĵж          ж¡ж¡ĵжʱִнű1602Ԫظı            ııԪظıʱִнű1602ύ          ύύύʱִнű1602          ááʱִнű1602Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1602Ԫʧȥ        ʧʧԪʧȥʱִнű1602Ԫػý        ýýԪػýʱִнű1602ͼж        ضϡضϡͼжʱִнű1602̱          ̱ʱִнű1602ºɿ        ɡɡ̱ºɿʱִнű1602̱ɿ          ɡɡ̱ɿʱִнű1602걻          걻ʱִнű1602걻˫          ˫˫걻˫ʱִнű1602갴ť      󰴡󰴡갴ťʱִнű1602ƶ            ơơָƶʱִнű1602Ƴ            ָƳĳԪʱִнű1602ͣ            ָͣĳԪ֮ʱִнű1602갴ťɿ      ɡɡ갴ťɿʱִнű1602ˮƽʹֱ      HTML <iframe> ǩ align 
HTML <iframe> ǩ
÷
align Թ涨 iframe ΧԪصˮƽʹֱ뷽ʽ

iframe ԪԪأҳϲУζıԪؿΧΧԣalign Կ԰ǹ涨 iframe ΧԪصĶ뷽ʽ
ʵ
Ҷ iframe

<iframe src ="/index.html" align="right">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
֧
ǲ޳ʹ align ԣǼָ֧ԡ
ʾ
 HTML 4.01 У޳ʹ iframe Ԫص align ԣ XHTML 1.0 Strict DTD Уָ֧ԡ

ʹ CSS 档

CSS ﷨<iframe style="float:right">

CSS ʵҸ iframe

ǵ CSS ̳Уҵй float Ե֪ʶ
﷨
<iframe align="value">ֵ
ֵ  
left  iframe 
right Ҷ iframe 
middle ж iframe 
top ڶ iframe 
bottom ڵײ iframe 
HTML <iframe> ǩ
1602Χ߿            ܱ߿ܱ߿HTML <iframe> ǩ frameborder 
HTML <iframe> ǩ
÷
frameborder Թ涨Ƿʾ iframe Χı߿

ʾʵԷԭòøԣʹ CSS Ӧñ߿ʽɫ

CSS ʵiframe ߿
ʵ
Ҷ iframe

<iframe src ="/index.html" frameborder="0">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe frameborder="value">ֵ
ֵ  
1 б߿Ĭֵ 
0 رձ߿ 
1602߶                ߡߡHTML <iframe> ǩ height 
HTML <iframe> ǩ
÷
height Թ涨 iframe ĸ߶ȡ
ʵ
дƶ߶ȺͿȵ iframe

<iframe src ="/index.html" width="400" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe height="value">ֵ
ֵ  
pixels ؼƵĸ߶ֵ "100px" 
percent ԰ԪذٷֱȼƵĸ߶ֵ "20%" 
1602ϳ            ҳҳHTML <iframe> ǩ longdesc 
HTML <iframe> ǩ
÷
longdesc Թ涨ָĳҳ URLҳй iframe Ľϳ

 longdesc Ե֧ԷǳûбҪʹøԡ

ʾΪĳ iframe ṩбҪĻֻҪ򵥵شһָҳӼɣӶκ˶ǿɼģ
ʵ
 longdesc Ե iframeָ˴гҳ棺

<iframe src ="/index.html" longdesc="w3school.txt">
<p>Your browser does not support iframes.</p>
</iframe>
֧
֧ longdesc ԡ
﷨
<iframe longdesc="value">ֵ
ֵ  
URL 涨 iframe ҳ URL

ֵܵ

? URL - ָվ㣨 src="www.example.com/description.txt"
? URL - ָվڵļ src="description.txt"
 
1602͵ײ߾      ±߾±߾HTML <iframe> ǩ marginheight 
HTML <iframe> ǩ
÷
marginheight Թ涨 iframe Ķ͵ײĿհױ߾࣬ؼơ
ʵ
 50 ض͵ײհױ߾ iframe

<iframe src ="/index.html" marginheight="50px">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe marginheight="value">ֵ
ֵ  
pixels 涨 iframe Ķ͵ײĿհױ߾࣬ؼơ 
1602ߺұ߱߾      ұ߾ұ߾HTML <iframe> ǩ marginwidth 
HTML <iframe> ǩ
÷
marginwidth Թ涨 iframe ߺұߵĿհױ߾࣬ؼơ
ʵ
 50 Ҳհױ߾ iframe

<iframe src ="/index.html" marginwidth="50px">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe marginwidth="value">ֵ
ֵ  
pixels 涨 iframe ߺұߵĿհױ߾࣬ؼơ 
1602                HTML <iframe> ǩ name 
HTML <iframe> ǩ
÷
name Թ涨 iframe ơ

iframe Ԫص name  JavaScript ԪأΪӵĿꡣ
ʵ
ΪĿ iframe

<iframe src="demo_iframe.htm" name="iframe_a">
  <p>Your browser does not support iframes.</p>
</iframe>
<a href="http://www.w3school.com.cn" target="iframe_a">W3School.com.cn</a>
TIY
﷨
<iframe name="value">ֵ
ֵ  
name 涨 iframe ơ 
1602              HTML <iframe> ǩ scrolling 
HTML <iframe> ǩ
÷
scrolling Թ涨Ƿ iframe ʾ

Ĭϵأݳ iframeͻ iframe С
ʵ
й iframe

<iframe src ="/index.html" scrolling="yes">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe scrolling="value">ֵ
ֵ  
auto Ҫ³ֹĬֵ 
yes ʼʾʹҪ 
no ӲʾʹҪ 
1602ĵ URL          ··HTML <iframe> ǩ src 
HTML <iframe> ǩ
÷
src Թ涨 iframe ʾĵ URL
ʵ
й iframe

<iframe src="/index.html">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe src="value">ֵ
ֵ  
URL 涨ʾ iframe еĵĵַ

ֵܵ

? URL - ָվ㣨 src="www.example.com/index.html"
? URL - ָվڵļ src="index.html"
 
1602                HTML <iframe> ǩ width 
HTML <iframe> ǩ
÷
width Թ涨 iframe Ŀȡ
ʵ
дƶ߶ȺͿȵ iframe

<iframe src ="/index.html" width="400" height="300">
<p>Your browser does not support iframes.</p>
</iframe>
TIY
﷨
<iframe width="value">ֵ
ֵ  
pixels ؼƵĿֵ "100px" 
percent ԰ԪذٷֱȼƵĿֵ "20%" 
978                HTML <form> ǩ
÷
<form> ǩΪû봴 HTML 

ܹ input ԪأıֶΡѡ򡢵ѡύťȵȡ

԰ menustextareafieldsetlegend  label Ԫء

ݡ
1639                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1639ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1639ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1639ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1639Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1639Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1639tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1639ĵ          ĵʱִнű1639ĵж          ж¡ж¡ĵжʱִнű1639Ԫظı            ııԪظıʱִнű1639ύ          ύύύʱִнű1639          ááʱִнű1639Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1639Ԫʧȥ        ʧʧԪʧȥʱִнű1639Ԫػý        ýýԪػýʱִнű1639ͼж        ضϡضϡͼжʱִнű1639̱          ̱ʱִнű1639ºɿ        ɡɡ̱ºɿʱִнű1639̱ɿ          ɡɡ̱ɿʱִнű1639걻          걻ʱִнű1639걻˫          ˫˫걻˫ʱִнű1639갴ť      󰴡󰴡갴ťʱִнű1639ƶ            ơơָƶʱִнű1639Ƴ            ָƳĳԪʱִнű1639ͣ            ָͣĳԪ֮ʱִнű1639갴ťɿ      ɡɡ갴ťɿʱִнű1639ύĿĵҳ  ͵ַ͵ַHTML <form> ǩ action 
HTML <form> ǩ
÷
 action Թ涨ύʱδͱݡ
ʵ
ıӵֶԼһύťύʱݻύΪ "form_action.asp" ҳ棺

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
﷨
<form action="value">ֵ
ֵ  
URL δͱݡ

ֵܵ

? URL - ָվ㣨 src="www.example.com/example.htm"
? URL - ָվڵļ src="example.htm"
 
1639ļ            ļ͡ļ͡HTML <form> ǩ accept 
HTML <form> ǩ
÷
accept Թ涨ܹͨļϴύļ͡

ʾʹøԡӦڷ֤ļϴ
ʵ
ڱʹ accept ԣϴ͵ļgif  jpeg

<form action="form_action.asp" accept="image/gif, image/jpeg">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <p>Your image: <input type="file" name="pic" id="pic" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
֧
עͣûȷ֧ accept ԡ
﷨
<form accept="value">ֵ
ֵ  
MIME_type ύһ MIME ͡

涨 MIME ͣʹöŷָǡ
 
1639ַܵַַHTML <form> ǩ accept-charset 
HTML <form> ǩ
÷
accept-charset Թ涨ַܵ

accept-charset ָһϵַ֧ЩַӶȷͱеݡ

ԵֵŰַбɽַûʹõַƥĻѡԱǽñԴ

ԵĬֵ "unknown"ʾַĵַͬ

ʾʹøԡӦڷ֤ļϴ
ʵ
ڱʹ accept-charset ԣ

<form action="form_action.asp" accept-charset="ISO-8859-1">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
֧
 Internet Exploreraccept-charset Եõ֧֡

עͣaccept-charset ޷ Internet Explorer ȷع accept-charset Ϊ "ISO-8859-1"IE  "Windows-1252" ݡ
﷨
<form accept-charset="value">ֵ
ֵ  
character_set ܹһַ涨ַʹöŷָǡ

õַУ

?UTF-8 - Unicode ַ
?ISO-8859-1 - ĸַ
ϣʹκַܹǡĳַʹõķΧԽ㣬Խп

鿴пõַǵ ַοֲᡣ
 
1639ݱ        ݱݱHTML <form> ǩ enctype 
HTML <form> ǩ
÷
enctype Թ涨ڷ͵֮ǰӦζԱݽб롣

ĬϵأݻΪ "application/x-www-form-urlencoded"˵ڷ͵֮ǰַб루ոתΪ "+" ӺţתΪ ASCII HEX ֵ
ʵ
Уݻδ½зͣ

<form action="form_action.asp" enctype="text/plain">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
﷨
<form enctype="value">ֵ
ֵ  
application/x-www-form-urlencoded ڷǰַĬϣ 
multipart/form-data ַ롣

ʹðļϴؼıʱʹøֵ
 
text/plain ոתΪ "+" Ӻţַ롣 
HTML <form> ǩ
1639η            ʽʽHTML <form> ǩ method 
HTML <form> ǩ
÷
method Թ涨ηͱݣݷ͵ action 涨ҳ棩

ݿΪ URL method="get" HTTP post method="post"ķʽ͡
ʵ
Уݽͨ method Ըӵ URL ϣ

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
method 
ʹ method õķеݴ͸дַPOST  GET 

 POST ᰴݡȣ action ָıϵһ֮ͻᰴֶδķݷ͸

ڷˣһ POST ʽӦóʼִʱӦôһ־λöȡһӦóܹʹЩֵǰЩн롣ûضķȷָӦóӦνЩ

һǲ GET ʱӣȻֱһ䲽зеıݣὫֱӸڱ action URL ֮֮ʺŽзָ

һͨκһַԴϢЩֻһַṩݡ <form> ǩ method ָҪ÷ݣʹ POST  GET
POST  GET
֧ POST ֧ GET ôѡַأйⷽһЩɣ

?ϣѱܣԲ GET ֶֻεС
?һЩϵͳڴݸӦóвʱĿͳȣ£ЩֶλǺܳıı˵Ӧò POST ͡
?ڱд˵ıӦó澭鲻㣬Ӧѡ GET  POST Ҫڶȡͽ뷽ЩĹҲⲢѣҲ㲻̫ԸȥЩ⡣
?ȫǸ⣬ôǽѡ POST GET ֱӷӦó URL У̽߿ԺɵزǣԴӷ־ļнժ¼аÿʺϢͻڲ֪Σûİȫ POST Ӧóûаȫ©ڽΪдʱٻԲüܵķ
?ڱ֮÷˵Ӧó򣬶Ұ䴫ݲḶ́Ҫ GET Ϊ÷ѱĲΪ URL һ֡һ棬ʹ POST ʽӦóȴϣ URL һĴ̣дݲΪͳ <a> ǩݡ
ȷݲ
ǰһЩҲΪѡַʽһ͡һܼ򵥵ıֻ x  y ڶЩԪصֵбʱǵʽʾ

x=28&y=66 method=GETô÷Ӧó URL ʾ

http://www.example.com/example/program?x=28&y=66κʱǶԴһͳ <a> ǩڵôֵıʽʾ 

<a href="http://www.example.com/example/program?x=28&y=66">Ψһǣָõ & ҲַʵеĲš <a> ǩ href зһ & ţͻὫַ滻Ӧַʵ塣

Ϊ˷ֹǱʵԵ滻 & ţҲ "&#38;"  "&amp;" 滻滻֮Ǹ÷ӦóķǱʾʾ

<a href="http://www.example.com/example/program?x=28&amp;y=66">ǲ URL ʹ & ţпڽңǹҲܹ÷ֺΪָҲԿԼķĵ˽Ƿֹ֧ܡ
﷨
<form target="value">ֵ
ֵ  
_blank ´д򿪡 
_self ĬϡͬĿд򿪡 
_parent ڸܼд򿪡 
_top д򿪡 
framename ָĿд򿪡 
1639                HTML <form> ǩ name 
HTML <form> ǩ
÷
name Թ涨ơ

form Ԫص name ṩһڽűñķ
ʵ
 name Ե HTML 

<form action="form_action.asp" method="get" name="myForm">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="button" onclick="formSubmit()" value="Send form data!" />
</form>
TIY
﷨
<form name="value">ֵ
ֵ  
name ơ 
HTML <form> ǩ
1639ںδ action URLδδHTML <form> ǩ target 
HTML <form> ǩ
÷
target Թ涨ںδ action URL
ʵ
У action й涨ҳ´д򿪣

<form action="form_action.asp" method="get" target="_blank">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
TIY
ע
 HTML 4.01 У޳ʹ form Ԫص target ԣ XHTML 1.0 Strict DTD Уָ֧ԡ
﷨
<form target="value">ֵ
ֵ  
_blank ´д򿪡 
_self ĬϡͬĿд򿪡 
_parent ڸܼд򿪡 
_top д򿪡 
framename ָĿд򿪡 
978ؼ            HTML <input> ǩ
÷
<input> ǩѼûϢ

ݲͬ type ֵֶӵкܶʽֶοıֶΡѡıؼѡťťȵȡ
1673                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1673ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1673ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1673ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1673Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1673Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1673tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1673ĵ          ĵʱִнű1673ĵж          ж¡ж¡ĵжʱִнű1673Ԫظı            ııԪظıʱִнű1673ύ          ύύύʱִнű1673          ááʱִнű1673Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1673Ԫʧȥ        ʧʧԪʧȥʱִнű1673Ԫػý        ýýԪػýʱִнű1673ͼж        ضϡضϡͼжʱִнű1673̱          ̱ʱִнű1673ºɿ        ɡɡ̱ºɿʱִнű1673̱ɿ          ɡɡ̱ɿʱִнű1673걻          걻ʱִнű1673걻˫          ˫˫걻˫ʱִнű1673갴ť      󰴡󰴡갴ťʱִнű1673ƶ            ơơָƶʱִнű1673Ƴ            ָƳĳԪʱִнű1673ͣ            ָͣĳԪ֮ʱִнű1673갴ťɿ      ɡɡ갴ťɿʱִнű1673ϴļ        ļ͡ļ͡HTML <input> ǩ accept 
HTML <input> ǩ
÷
accept ֻ <input type="file"> ʹá涨ܹͨļϴύļ͡

ʾʹøԡӦڷ֤ļϴ
ʵ
ļϴʹ accept ԣеֶοԽ GIF  JPEG ͼ

<form>
  <input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
</form>
ͼĸʽдΪaccept="image/*"
﷨
<input accept="value">ֵ
ֵ  
MIME_type öŸ MIME б 
1673뷽ʽ            HTML <input> ǩ align 
HTML <input> ǩ
÷
align ֻ <input type="image"> ʹá涨ͼΧԪصĶ뷽ʽ
ʵ
ıӵֶԼһͼʽύť

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="image" src="submit.jpg" alt="Submit" align="right" />
  <p>This is some text This is some text This is some text.</p>
</form>
һ
֧
ֻ "left"  "right" ֵõ֧֡
ע
 HTML 4.01 У޳ʹ input Ԫص align ԡ XHTML 1.0 Strict DTD вָ֧ԡ

ʹ CSS 档

CSS ﷨<input type="image" style="float:right" />

CSS ʵ:  input ͼ

ǵ CSS ̳Уҵй float  ϸڡ
﷨
<input accept="value">ֵ
ֵ  
left ͼĬϣ 
right Ҷ 
top ϶ͼ 
middle жͼ 
bottom ¶ͼ 
1673ı            ġġHTML <input> ǩ alt 
HTML <input> ǩ
÷
alt ֻ <input type="image"> ʹáΪͼ涨ı

alt ΪûĳЩԭ޷鿴ͼʱṩ˱ѡϢ

עͣʹ alt ԲǱԣǵΪ image ʱȻӦøԡʹøԣпܶıǿӵʹϰ
ʵ
ıӵֶԼһͼʽύť

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="image" src="submit.jpg" alt="Submit" align="right" />
</form>
һ
֧
 Safari֧ "alt" ԡ
﷨
<input alt="value">ֵ
ֵ  
value ͼ input ı 
1673ѡ              ѡѡHTML <input> ǩ checked 
HTML <input> ǩ
÷
checked Թ涨ҳʱӦñԤѡ input Ԫء

checked   <input type="checkbox">  <input type="radio"> ʹá

checked Ҳҳغͨ JavaScript á
ʵ
һԤѡѡ HTML 

<form action="form_action.asp" method="get">
<input type="checkbox" name="vehicle" value="Car" checked="checked" /> I have a car
</form>
һ
﷨
<input checked="value">ֵ
ֵ  
checked Ԥѡѡѡť 
1673 input Ԫ     ááHTML <input> ǩ disabled 
HTML <input> ǩ
÷
disabled Թ涨Ӧý input Ԫء

õ input ԪؼȲãҲɵ disabled ԣֱĳЩΪֹѡһѡȵȣȻ󣬾Ҫͨ JavaScript ɾ disabled ֵ input ԪصֵлΪá

עͣdisabled ޷ <input type="hidden"> һʹá
ʵ
һֶε HTML 

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" disabled="disabled" /></p>
  <input type="submit" value="Submit" />
</form>
һ
﷨
<input disabled="value">ֵ
ֵ  
disabled һ input Ԫء 
1673󳤶            󳤡󳤡HTML <input> ǩ maxlength 
HTML <input> ǩ
÷
maxlength Թ涨ֶε󳤶ȣַơ

maxlength  <input type="text">  <input type="password"> ʹá
ʵ
 HTML 󳤶ȷֱ 85  55 ֶַΣ

<form action="form_action.asp" method="get">
  <p>Name: <input type="text" name="fullname" maxlength="85" /></p>
  <p>Email: <input type="text" name="email" maxlength="55" /></p>
  <input type="submit" value="Submit" />
</form>
һ
﷨
<input maxlength="value">ֵ
ֵ  
characters ֶַ 
1673                HTML <input> ǩ name 
HTML <input> ǩ
÷
name Թ涨 input Ԫصơ

name ڶύıݽбʶڿͻͨ JavaScript ñݡ

עֻͣ name ԵıԪزύʱǵֵ
ʵ
ıֶκһύť HTML 

<form action="form_action.asp" method="get">
  <p>Name: <input type="text" name="fullname" /></p>
  <p>Email: <input type="text" name="email" /></p>
  <input type="submit" value="Submit" />
</form>
һ
﷨
<input name="value">ֵ
ֵ  
name Ԫصơ 
1673ֶΪֻ          ֻֻHTML <input> ǩ readonly 
HTML <input> ǩ
÷
readonly Թ涨ֶΪֻ

ֶֻǲ޸ĵġûȻʹ tab лֶΣѡл򿽱ı

readonly ԿԷֹûֵ޸ģֱĳЩΪֹѡһѡ򣩡ȻҪʹ JavaScript  readonly ֵֶлɱ༭״̬

readonly Կ <input type="text">  <input type="password"> ʹá
ʵ
ıֶκһύť HTML 

<form action="form_action.asp" method="get">
  Name:<input type="text" name="email" />
  Country:<input type="text" name="country" value="China" readonly="readonly" />
  <input type="submit" value="Submit" />
</form>
һ
﷨
<input readonly="value">ֵ
ֵ  
readonly ֶΪֻ 
1673ֶεĿ          ߴߴHTML <input> ǩ size 
HTML <input> ǩ
÷
size Թ涨ֶεĿȡ

 <input type="text">  <input type="password">size Զǿɼַͣsize ԶΪλֶοȡ
ʵ
 HTML ֱֶΣȷֱ 35 ַ 18 ַ

<form action="form_action.asp" method="get">
  <p>Email: <input type="text" name="email" size="35" /></p>
  <p>PIN: <input type="text" name="pin" maxlength="18" size="18" /></p>
  <input type="submit" value="Submit" />
</form>
һ
ʾ
 size һӻԣƼʹ CSS 

CSS ﷨<input style="width:100px" />

CSS ʵֶεĿȡ

 W3School  CSS ̳Уҵй width  ϸڡ
﷨
<input size="value">ֵ
ֵ  
characters/pixels input ԪصĿȡ 
1673ťʾͼ      ··HTML <input> ǩ src 
HTML <input> ǩ
÷
src ֻ <input type="image"> ʹá涨Ϊύťʾͼ URL

src Ա <input type="image"> ͬʱʹá
ʵ
ıӵֶԼһͼʽύť

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="image" src="submit.jpg" alt="Submit" align="right" />
</form>
һ
﷨
<input src="value">ֵ
ֵ  
URL Ϊύťʹõͼ URL

ֵܵ

? URL - ָһվ㣨 src="www.example.com/submit.gif"
? URL - ָվڵļ src="submit.gif"
 
1673inputԪ       ͡͡HTML <input> ǩ type 
HTML <input> ǩ
÷
type Թ涨 input Ԫص͡
ʵ
ıӵֶԼһύť

<form action="form_action.asp" method="get">
  <p>First name: <input type="text" name="fname" /></p>
  <p>Last name: <input type="text" name="lname" /></p>
  <input type="submit" value="Submit" />
</form>
һԣҳҵӣ
﷨
<input type="value">ֵ
ֵ  
button ɵť£ͨ JavaScript ű 
checkbox 帴ѡ 
file ֶκ ""ťļϴ 
hidden صֶΡ 
image ͼʽύť 
password ֶΡֶеַ롣 
radio 嵥ѡť 
reset ðťðťеݡ 
submit ύťύťѱݷ͵ 
text 嵥еֶΣûıĬϿΪ 20 ַ 
1673input Ԫ趨ֵ    ֵֵHTML <input> ǩ value 
HTML <input> ǩ
÷
value Ϊ input Ԫ趨ֵ

ڲͬͣvalue Ե÷Ҳͬ

?type="button", "reset", "submit" - 尴ťϵʾı
?type="text", "password", "hidden" - ֶεĳʼֵ
?type="checkbox", "radio", "image" - ֵ
עͣ<input type="checkbox">  <input type="radio"> б value ԡ

עͣvalue ޷ <input type="file"> һͬʹá
ʵ
ıӵֶԼһύť - ǶԤֵ

<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" value="George" /><br />
  Last name: <input type="text" name="lname" value="Bush" /><br />
  <input type="submit" value="Submit form" />
</form>һ
﷨
<input value="value">ֵ
ֵ  
value input Ԫصֵ 
HTML <input> ǩ
978ı        HTML <textarea> ǩ
÷
<textarea> ǩеıؼ

ıпıеıĬǵȿ壨ͨ Courier

ͨ cols  rows 涨 textarea ĳߴ磬õİ취ʹ CSS  height  width ԡ

עͣıڵıм䣬 "%OD%OA" س/Узָ

ʾͨ <textarea> ǩ wrap ıڵĻģʽ
1712                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1712ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1712ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1712ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1712Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1712Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1712tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1712ĵ          ĵʱִнű1712ĵж          ж¡ж¡ĵжʱִнű1712Ԫظı            ııԪظıʱִнű1712ύ          ύύύʱִнű1712          ááʱִнű1712Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1712Ԫʧȥ        ʧʧԪʧȥʱִнű1712Ԫػý        ýýԪػýʱִнű1712ͼж        ضϡضϡͼжʱִнű1712̱          ̱ʱִнű1712ºɿ        ɡɡ̱ºɿʱִнű1712̱ɿ          ɡɡ̱ɿʱִнű1712걻          걻ʱִнű1712걻˫          ˫˫걻˫ʱִнű1712갴ť      󰴡󰴡갴ťʱִнű1712ƶ            ơơָƶʱִнű1712Ƴ            ָƳĳԪʱִнű1712ͣ            ָͣĳԪ֮ʱִнű1712갴ťɿ      ɡɡ갴ťɿʱִнű1712ɼ            ССHTML <textarea> ǩ cols 
HTML <textarea> ǩ
÷
cols Թ涨 textarea Ŀɼȡ
ʵ
һ 25 ַ 3 иߵı

<textarea rows="3" cols="20">
w3schoolҵҪеվ̡̳
</textarea>
TIY
﷨
<textarea cols="value">ֵ
ֵ  
number 涨ıĿȣƽַƣ 
1712ɼ            ССHTML <textarea> ǩ rows 
HTML <textarea> ǩ
÷
rows Թ涨 textarea Ŀɼ߶ȡ
ʵ
һ 25 ַ 3 иߵı

<textarea rows="3" cols="20">
w3schoolҵҪеվ̡̳
</textarea>
TIY
﷨
<textarea rows="value">ֵ
ֵ  
number 涨ıĸ߶ȣƣ 
1712ı          ááHTML <textarea> ǩ disabled 
HTML <textarea> ǩ
÷
disabled Թ涨ıõıȲãҲɵ

 disabled ԣֱĳЩѡһѡ򣩣ŻָûԸıʹáȻ󣬿ʹ JavaScript  disabled ԣʹıΪ״̬
ʵ
һõı

<textarea rows="3" cols="20" disabled="disabled">
w3schoolҵҪеվ̡̳
</textarea>
TIY
﷨
<textarea disabled="value">ֵ
ֵ  
disabled 涨Ӧýøı 
1712                HTML <textarea> ǩ name 
HTML <textarea> ǩ
÷
name Ϊı涨ơ

name  JavaScript жԪؽãڱύ֮󣬶Աݽá
ʵ
һ name Եı

<textarea rows="3" cols="20" name="W3School_text">
w3schoolҵҪеվ̡̳
</textarea>
TIY
﷨
<textarea name="value">ֵ
ֵ  
name_of_textarea 涨ıơ 
1712ıΪֻ        ֻֻHTML <textarea> ǩ readonly 
HTML <textarea> ǩ
÷
readonly Թ涨ıΪֻ

ֻıУ޷ݽ޸ģûͨ tab лÿؼѡȡеݡ

 readonly ԣֱĳЩѡһѡ򣩣ŻָûԸıʹáȻ󣬿ʹ JavaScript  readonly ԣʹıΪɱ༭״̬
ʵ
һ name Եı

<textarea rows="3" cols="20" readonly="readonly">
w3schoolҵҪеվ̡̳
</textarea>
TIY
﷨
<textarea readonly="value">ֵ
ֵ  
readonly 涨ıΪֻ 
978ť                ťťHTML <button> ǩ
÷
<button> ǩһť

 button ԪڲԷݣıͼǸԪʹ input Ԫشİť֮Ĳ֮ͬ

<button> ؼ  <input type="button"> ȣṩ˸ΪǿĹܺ͸ḻݡ<button>  </button> ǩ֮ݶǰťݣаκοɽܵݣıýݡ磬ǿڰťаһͼصıڰťдһ˵ıͼ

ΨһֹʹõԪͼӳ䣬ΪͼеĶűťΪ

ʼΪť涨 type ԡInternet Explorer Ĭ "button"У W3C 淶Ĭֵ "submit"
1744                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1744ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1744ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1744ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1744Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1744Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1744tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1744ĵ          ĵʱִнű1744ĵж          ж¡ж¡ĵжʱִнű1744Ԫظı            ııԪظıʱִнű1744ύ          ύύύʱִнű1744          ááʱִнű1744Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1744Ԫʧȥ        ʧʧԪʧȥʱִнű1744Ԫػý        ýýԪػýʱִнű1744ͼж        ضϡضϡͼжʱִнű1744̱          ̱ʱִнű1744ºɿ        ɡɡ̱ºɿʱִнű1744̱ɿ          ɡɡ̱ɿʱִнű1744걻          걻ʱִнű1744걻˫          ˫˫걻˫ʱִнű1744갴ť      󰴡󰴡갴ťʱִнű1744ƶ            ơơָƶʱִнű1744Ƴ            ָƳĳԪʱִнű1744ͣ            ָͣĳԪ֮ʱִнű1744갴ťɿ      ɡɡ갴ťɿʱִнű1744ðť            ááHTML <button> ǩ disabled 
HTML <button> ǩ
÷
disabled Թ涨ðť

õİťȲãҲɵ

 disabled ԣֱĳЩѡһѡ򣩣ŻָûԸðťʹáȻ󣬿ʹ JavaScript  disabled ԣʹıΪ״̬
ʵ
һõİť

<button type="button" disabled="disabled">Click Me!</button>TIY
﷨
<button disabled="value">ֵ
ֵ  
disabled 涨Ӧýøðť 
1744                HTML <button> ǩ name 
HTML <button> ǩ
÷
name Ϊť涨ơ

name  JavaScript жԪؽãڱύ֮󣬶Աݽá

ʾͬ button ԪؿԹͬơǴͬƵɰťԱڱʹʱܹύֵͬ
ʵ
ťͬƣڵʱύֵͬ

<form action="demo_button_name.asp" method="get">
  Choose your favorite subject:
  <button name="subject" type="submit" value="HTML">HTML</button>
  <button name="subject" type="submit" value="CSS">CSS</button>
</form>
TIY
﷨
<button name="value">ֵ
ֵ  
name 涨ťơ 
1744ť          ͡͡HTML <button> ǩ type 
HTML <button> ǩ
÷
type Թ涨ť͡

ʾʼΪť涨 type ԡInternet Explorer Ĭ "button"У W3C 淶Ĭֵ "submit"
ʵ
 button Ԫأһύťһðť

<form action="form_action.asp" method="get">
  First name: <input type="text" name="fname" />
  Last name: <input type="text" name="lname" />
  <button type="submit" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>
TIY
﷨
<button type="value">ֵ
ֵ  
submit ðťύť Internet ExplorerֵĬֵ 
button ðťǿɵİťInternet Explorer Ĭֵ 
reset ðťðťݣ 
1744ʼֵ              ֵֵHTML <button> ǩ value 
HTML <button> ǩ
÷
value Թ涨밴ťĳʼֵ

Ҫ HTML ʹ button ԪأͬύֵͬInternet Explorer ύ <button>  <button/> ֮ıύ value Եݡ HTML ʹ input Ԫť
ʵ
ťͬƣڵʱύֵͬ

<form action="demo_button_name.asp" method="get">
  Choose your favorite subject:
  <button name="subject" type="submit" value="HTML">HTML</button>
  <button name="subject" type="submit" value="CSS">CSS</button>
</form>
TIY
﷨
<button value="value">ֵ
ֵ  
value 涨Ҫ͵ֵ 
978б            HTML <select> ǩ
÷
select Ԫؿɴѡѡ˵

ύʱύѡĿռöŷָĶѡϳһĲбڽ <select> ύʱ name ԡ
1775                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1775ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1775ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1775ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1775Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1775Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1775tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1775ĵ          ĵʱִнű1775ĵж          ж¡ж¡ĵжʱִнű1775Ԫظı            ııԪظıʱִнű1775ύ          ύύύʱִнű1775          ááʱִнű1775Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1775Ԫʧȥ        ʧʧԪʧȥʱִнű1775Ԫػý        ýýԪػýʱִнű1775ͼж        ضϡضϡͼжʱִнű1775̱          ̱ʱִнű1775ºɿ        ɡɡ̱ºɿʱִнű1775̱ɿ          ɡɡ̱ɿʱִнű1775걻          걻ʱִнű1775걻˫          ˫˫걻˫ʱִнű1775갴ť      󰴡󰴡갴ťʱִнű1775ƶ            ơơָƶʱִнű1775Ƴ            ָƳĳԪʱִнű1775ͣ            ָͣĳԪ֮ʱִнű1775갴ťɿ      ɡɡ갴ťɿʱִнű1775                ááHTML <select> ǩ disabled 
HTML <select> ǩ
÷
disabled Թ涨бõбȲãҲɵ

 disabled ԣֱĳЩѡһѡ򣩣ŻָûԸбʹáȻ󣬿ʹ JavaScript  disabled ԣʹбΪ״̬
ʵ
һõб

<select disabled="disabled">
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
TIY
֧
֧ disabled ԡ
﷨
<select disabled="value">ֵ
ֵ  
disabled 涨Ӧýøб 
1775ͬʱѡ      ѡѡHTML <select> ǩ multiple 
HTML <select> ǩ
÷
multiple Թ涨ͬʱѡѡ

ڲͬϵͳУѡѡĲ죺

? windowsס Ctrl ťѡѡ
? Macס command ťѡѡ
ĴڣͬʱҪ֪ûʹöѡ񣬶ûѺõķʽʹøѡ

ʾ԰ multiple  size ʹãɼѡĿ
ʵ
бнжѡ

<select multiple="multiple" size="2">
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
TIY
֧
֧ multiple ԡ
﷨
<select multiple="value">ֵ
ֵ  
multiple 涨ͬʱѡѡ 
1775                HTML <select> ǩ name 
HTML <select> ǩ
÷
name Թ涨 select Ԫصơ

name ڶύıݽбʶڿͻͨ JavaScript ñݡ
ʵ
 name Եб

<select name="carlist">
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
TIY
֧
֧ name ԡ
﷨
<select name="value">ֵ
ֵ  
name бơ 
1775ɼѡĿ      ߴߴHTML <select> ǩ size 
HTML <select> ǩ
÷
size Թ涨бпɼѡĿ

 size Եֵ 1СбѡĿʾʾԲ鿴ѡ
ʵ
б size ʾѡ

<select size="2">
  <option value ="volvo">Volvo</option>
  <option value ="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>
TIY
֧
֧ size ԡ
﷨
<select size="value">ֵ
ֵ  
number бпɼѡĿ 
978ѡбѡ  ءءHTML <optgroup> ǩ
÷
<optgroup> ǩѡ顣

optgroup Ԫѡʹһѡбʱصѡϻʹס
1806                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1806ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1806ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1806ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1806Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1806Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1806tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1806ĵ          ĵʱִнű1806ĵж          ж¡ж¡ĵжʱִнű1806Ԫظı            ııԪظıʱִнű1806ύ          ύύύʱִнű1806          ááʱִнű1806Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1806Ԫʧȥ        ʧʧԪʧȥʱִнű1806Ԫػý        ýýԪػýʱִнű1806ͼж        ضϡضϡͼжʱִнű1806̱          ̱ʱִнű1806ºɿ        ɡɡ̱ºɿʱִнű1806̱ɿ          ɡɡ̱ɿʱִнű1806걻          걻ʱִнű1806걻˫          ˫˫걻˫ʱִнű1806갴ť      󰴡󰴡갴ťʱִнű1806ƶ            ơơָƶʱִнű1806Ƴ            ָƳĳԪʱִнű1806ͣ            ָͣĳԪ֮ʱִнű1806갴ťɿ      ɡɡ갴ťɿʱִнű1806ѡ涨      עעHTML <optgroup> ǩ label 
HTML <optgroup> ǩ
÷
label Ϊѡ涨
ʵ
ͨ <optgroup> ǩصѡһ

<select>
  <optgroup label="Swedish Cars">
    <option value ="volvo">Volvo</option>
    <option value ="saab">Saab</option>
  </optgroup>

  <optgroup label="German Cars">
    <option value ="mercedes">Mercedes</option>
    <option value ="audi">Audi</option>
  </optgroup>
</select>
TIY
֧
֧ label ԡ
﷨
<optgroup label="value">ֵ
ֵ  
text йرѡݡ 
1806                ááHTML <optgroup> ǩ disabled 
HTML <optgroup> ǩ
÷
disabled Թ涨øѡ顣õѡȲãҲɵ

 disabled ԣֱĳЩѡһѡ򣩣ŻָûԸѡʹáȻ󣬿ʹ JavaScript  disabled ԣʹѡΪ״̬
ʵ
һõѡ飺

<select>
  <optgroup label="German Cars" disabled="disabled">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>
TIY
֧
 Internet Explorer֧ label ԡ

עͣSafari 2.0 İ汾ָ֧ԡIE 8 µİ汾ָ֧ԡ
﷨
<optgroup disabled="value">ֵ
ֵ  
disabled ѡ顣 
978ѡбѡ      ѡѡHTML <option> ǩ
÷
option ԪضбеһѡһĿ

 <option> ǩеΪ <select> ǩĲ˵ǹбеһԪʾ

option Ԫλ select Ԫڲ
1835                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1835ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1835ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1835ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1835Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1835Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1835tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1835ĵ          ĵʱִнű1835ĵж          ж¡ж¡ĵжʱִнű1835Ԫظı            ııԪظıʱִнű1835ύ          ύύύʱִнű1835          ááʱִнű1835Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1835Ԫʧȥ        ʧʧԪʧȥʱִнű1835Ԫػý        ýýԪػýʱִнű1835ͼж        ضϡضϡͼжʱִнű1835̱          ̱ʱִнű1835ºɿ        ɡɡ̱ºɿʱִнű1835̱ɿ          ɡɡ̱ɿʱִнű1835걻          걻ʱִнű1835걻˫          ˫˫걻˫ʱִнű1835갴ť      󰴡󰴡갴ťʱִнű1835ƶ            ơơָƶʱִнű1835Ƴ            ָƳĳԪʱִнű1835ͣ            ָͣĳԪ֮ʱִнű1835갴ťɿ      ɡɡ갴ťɿʱִнű1835                ááHTML <option> ǩ disabled 
HTML <option> ǩ
÷
disabled Թ涨ĳѡӦñáõѡȲãҲɵ

 disabled ԣֱĳЩѡһѡ򣩣ŻָûԸѡʹáȻ󣬿ʹ JavaScript  disabled ԣʹѡΪ״̬
ʵ
 4 ѡбһѡѱã

<select>
  <option>Volvo</option>
  <option>Saab</option>
  <option disabled="disabled">Opel</option>
  <option>Audi</option>
</select>
TIY
֧
 Internet Explorer֧ disabled ԡ

עͣSafari 2.0 İ汾ָ֧ԡIE 8 µİ汾ָ֧ԡ
﷨
<option disabled="value">ֵ
ֵ  
disabled 涨Ӧýѡ 
1835̰汾            עעHTML <option> ǩ label 
HTML <option> ǩ
÷
label Թ涨̰汾ѡ

блʾ涨ĸ̰汾
ʵ
 option Ԫʹ label ԣ

<select>
  <option label="Volvo">Volvo (Latin for "I roll")</option>
  <option label="Saab">Saab (Swedish Aeroplane AB)</option>
</select>
TIY
֧
ֻ IE 7+ ֧ label ԡ
﷨
<option label="value">ֵ
ֵ  
text ѡĸ̵İ汾 
1835ѡ״̬            ѡСѡСHTML <option> ǩ selected 
HTML <option> ǩ
÷
selected Թ涨ҳʱԤѡѡ

Ԥѡѡʾбǰλá

Ҳҳغͨ JavaScript  selected ԡ
ʵ
Ԥѡѡб

<select>
  <option>Volvo</option>
  <option selected="selected">Saab</option>
  <option>Mercedes</option>
  <option>Audi</option>
</select>
TIY
֧
֧ selected ԡ
﷨
<option selected="value">ֵ
ֵ  
selected Ԥѡһѡ 
1835͵ֵ  ֵֵHTML <option> ǩ value 
HTML <option> ǩ
÷
value Թ涨ڱύʱ͵ֵ

<option>  <option/> ֵ֮ʾбеݣ value еֵǱύʱ͵ֵ

עͣûָ value ԣѡֵΪ <option> ǩеݡ
ʵ
з͵ֵб

<select>
  <option value="volvo">Volvo XC90</option>
  <option value="saab">Saab 95</option>
  <option value="mercedes">Mercedes SLK</option>
  <option value="audi">Audi TT</option>
</select>
TIY
֧
֧ value ԡ
﷨
<option value="value">ֵ
ֵ  
value ͵ֵ 
978input Ԫرע      עעHTML <label> ǩ
÷
<label> ǩΪ input Ԫضעǣ

label ԪزûκЧΪûĽ˿ԡ label Ԫڵıͻᴥ˿ؼ˵ûѡñǩʱͻԶתͱǩصıؼϡ

<label> ǩ for ӦԪص id ͬ
1866                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1866ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1866ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1866ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1866Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1866Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1866tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1866ĵ          ĵʱִнű1866ĵж          ж¡ж¡ĵжʱִнű1866Ԫظı            ııԪظıʱִнű1866ύ          ύύύʱִнű1866          ááʱִнű1866Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1866Ԫʧȥ        ʧʧԪʧȥʱִнű1866Ԫػý        ýýԪػýʱִнű1866ͼж        ضϡضϡͼжʱִнű1866̱          ̱ʱִнű1866ºɿ        ɡɡ̱ºɿʱִнű1866̱ɿ          ɡɡ̱ɿʱִнű1866걻          걻ʱִнű1866걻˫          ˫˫걻˫ʱִнű1866갴ť      󰴡󰴡갴ťʱִнű1866ƶ            ơơָƶʱִнű1866Ƴ            ָƳĳԪʱִнű1866ͣ            ָͣĳԪ֮ʱִнű1866갴ťɿ      ɡɡ갴ťɿʱִнű1866Ԫذ        󶨡󶨡HTML <label> ǩ for 
HTML <label> ǩ
÷
for Թ涨 label ĸԪذ󶨡

ʽʽϵ
ַͨʽеһͱؼϵؼΪǱǩݣľʽʽΪ <label> ǩµ for һĿ idʽʽ

磬 XHTML У

ʽϵ
<label for="SSN">Social Security Number:</label>
<input type="text" name="SocSecNum" id="SSn" />

ʽϵ
<label>Date of Birth: <input type="text" name="DofB" /></label>
һʽʽı "Social Security Number:" ͱᰲȫıؼ ("SocSecNum") ϵ for ԵֵͿؼ id һ SSNڶ ("Date of Birth:") Ҫ for ԣؿؼҲҪ id ԣͨ <label> ǩз <input> ǩʽġ
ʵ
ֶκرǵļ HTML 

<form>
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" />
  <br />
  <label for="female">Female</label>
  <input type="radio" name="sex" id="female" />
</form>
TIY
֧
֧ for ԡ

Safari 2 İ汾֧ for ԡ
﷨
<label for="value">ֵ
ֵ  
element_id label Ҫ󶨵Ԫص id 
978Ԫر߿        HTML <fieldset> ǩ
÷
fieldset ԪؿɽڵԪط顣

<fieldset> ǩݵһִһرֶΡ

һԪطŵ <fieldset> ǩʱⷽʽʾǣǿı߽硢3D ЧɴһӱЩԪء

<fieldset> ǩûбĻΨһԡ

978fieldset Ԫر   HTML <legend> ǩ
÷
legend ԪΪ fieldset Ԫض⣨caption
1895                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1895ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1895ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1895ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1895Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1895Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1895tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1895ĵ          ĵʱִнű1895ĵж          ж¡ж¡ĵжʱִнű1895Ԫظı            ııԪظıʱִнű1895ύ          ύύύʱִнű1895          ááʱִнű1895Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1895Ԫʧȥ        ʧʧԪʧȥʱִнű1895Ԫػý        ýýԪػýʱִнű1895ͼж        ضϡضϡͼжʱִнű1895̱          ̱ʱִнű1895ºɿ        ɡɡ̱ºɿʱִнű1895̱ɿ          ɡɡ̱ɿʱִнű1895걻          걻ʱִнű1895걻˫          ˫˫걻˫ʱִнű1895갴ť      󰴡󰴡갴ťʱִнű1895ƶ            ơơָƶʱִнű1895Ƴ            ָƳĳԪʱִнű1895ͣ            ָͣĳԪ֮ʱִнű1895갴ťɿ      ɡɡ갴ťɿʱִнű1895뷽ʽ            HTML <legend> ǩ align 
HTML <legend> ǩ
÷
align Թ涨 fieldset бĶ뷽ʽ
ʵ
ϱеԪأ

<form>
  <fieldset>
    <legend align="right">health information</legend>
    height: <input type="text" />
    weight: <input type="text" />
  </fieldset>
</form>
TIY
֧
֧ align Ե "left"  "right" ֵ opera"bottom" ֵжá
ע
 HTML 4 У޳ʹ align ԣ XHTML Strict DTD Уָ֧ԡ
﷨
<legend align="value">ֵ
ֵ  
left Ա롣 
right ԱҶ롣 
top Ա϶롣 
bottom Ա¶롣 
978ĵصĿ޳ʹáĵصĿ978б            ббHTML <ul> ǩ
÷
<ul> ǩб
1924                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1924ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1924ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1924ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1924Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1924Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1924tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1924ĵ          ĵʱִнű1924ĵж          ж¡ж¡ĵжʱִнű1924Ԫظı            ııԪظıʱִнű1924ύ          ύύύʱִнű1924          ááʱִнű1924Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1924Ԫʧȥ        ʧʧԪʧȥʱִнű1924Ԫػý        ýýԪػýʱִнű1924ͼж        ضϡضϡͼжʱִнű1924̱          ̱ʱִнű1924ºɿ        ɡɡ̱ºɿʱִнű1924̱ɿ          ɡɡ̱ɿʱִнű1924걻          걻ʱִнű1924걻˫          ˫˫걻˫ʱִнű1924갴ť      󰴡󰴡갴ťʱִнű1924ƶ            ơơָƶʱִнű1924Ƴ            ָƳĳԪʱִнű1924ͣ            ָͣĳԪ֮ʱִнű1924갴ťɿ      ɡɡ갴ťɿʱִнű1924С            աաHTML <ul> ǩ compact 
HTML <ul> ǩ
÷
compact Թ涨бֵЧСɣͨмԼбʵֵġ
ʵ
бʹ compact ԣ

<ul compact="compact">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</ul>
TIY
֧
κ֧ compact ԡ
ע
 HTML 4.01 У޳ʹ ul Ԫص compact ԣ XHTML 1.0 Strict DTD У֧ ul Ԫص compact ԡ

ʹ CSS 档

CSS ﷨<ul style="line-height: 80%">

CSS ʵСбеи

ǵ CSS ̳Уҵй line-height  ϸڡ
﷨
<ul compact="value">ֵ
ֵ  
compact 涨бָСɵЧ 
1924Ŀ            ͡͡HTML <ul> ǩ type 
HTML <ul> ǩ
÷
type Թ涨бĿŵ͡
ʵ
бʹ type ԣ

<ul type="square">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</ul>
TIY
֧
ܲ޳ʹ type ԣ֧ type ԡ
ע
 HTML 4.01 У޳ʹ ul Ԫص type ԣ XHTML 1.0 Strict DTD У֧ ul Ԫص type ԡ

ʹ CSS 档

CSS ﷨<ul style="list-style-type:square">

CSS ʵбʽ

ǵ CSS ̳Уҵй list-style-type  ϸڡ
﷨
<ul type="value">ֵ
ֵ  
disc ĬֵʵԲ 
circle Բ 
square ʵķ顣 
978б            ббHTML <ol> ǩ
÷
<ol> ǩб
1953                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1953ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1953ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1953ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1953Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1953Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1953tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1953ĵ          ĵʱִнű1953ĵж          ж¡ж¡ĵжʱִнű1953Ԫظı            ııԪظıʱִнű1953ύ          ύύύʱִнű1953          ááʱִнű1953Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1953Ԫʧȥ        ʧʧԪʧȥʱִнű1953Ԫػý        ýýԪػýʱִнű1953ͼж        ضϡضϡͼжʱִнű1953̱          ̱ʱִнű1953ºɿ        ɡɡ̱ºɿʱִнű1953̱ɿ          ɡɡ̱ɿʱִнű1953걻          걻ʱִнű1953걻˫          ˫˫걻˫ʱִнű1953갴ť      󰴡󰴡갴ťʱִнű1953ƶ            ơơָƶʱִнű1953Ƴ            ָƳĳԪʱִнű1953ͣ            ָͣĳԪ֮ʱִнű1953갴ťɿ      ɡɡ갴ťɿʱִнű1953С            աաHTML <ol> ǩ compact 
HTML <ol> ǩ
÷
compact Թ涨бֵЧСɣͨмԼбʵֵġ
ʵ
бʹ compact ԣ

<ol compact="compact">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</ol>
TIY
֧
κ֧ compact ԡ
ע
 HTML 4.01 У޳ʹ ol Ԫص compact ԣ XHTML 1.0 Strict DTD У֧ ol Ԫص compact ԡ

ʹ CSS 档

CSS ﷨<ol style="line-height: 80%">

CSS ʵСбеи

ǵ CSS ̳Уҵй line-height  ϸڡ
﷨
<ol compact="value">ֵ
ֵ  
compact 涨бָСɵЧ 
1953ʼ              ʼʼHTML <ol> ǩ start 
HTML <ol> ǩ
÷
start Թ涨бĿʼ㡣
ʵ
бʹ start ԣ

<ol start="5">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</ol>
TIY
֧
ܲ޳ʹ start ԣ֧ start ԡ
ע
 HTML 4.01 У޳ʹ ol Ԫص start ԣ XHTML 1.0 Strict DTD У֧ ol Ԫص start ԡ

עͣĿǰȻû start Ե CSS 
﷨
<ol start="value">ֵ
ֵ  
number ֡бĿʼ㡣 
1953ŵ          ͡͡HTML <ol> ǩ type 
HTML <ol> ǩ
÷
type Թ涨бĿŵ͡
ʵ
бʹ type ԣ

<ol type="I">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</ol>
TIY
֧
ܲ޳ʹ type ԣ֧ type ԡ
ע
 HTML 4.01 У޳ʹ ol Ԫص type ԣ XHTML 1.0 Strict DTD У֧ ol Ԫص type ԡ

ʹ CSS 档

CSS ﷨<ol style="list-style-type:upper-roman">

CSS ʵбʽ

ǵ CSS ̳Уҵй list-style-type  ϸڡ
﷨
<ol type="value">ֵ
ֵ  
1 Ĭֵб1234 
a ĸ˳ебСдabcd 
A ĸ˳ебдABCD 
i ĸСдi, ii, iii, iv 
I ĸдI, II, III, IV 
978бĿ            бĿбĿHTML <li> ǩ
÷
<li> ǩбĿ

<li> ǩб (<ol>) б (<ul>) С
1983                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
1983ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ1983ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
1983ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
1983Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο1983Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
1983tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ1983ĵ          ĵʱִнű1983ĵж          ж¡ж¡ĵжʱִнű1983Ԫظı            ııԪظıʱִнű1983ύ          ύύύʱִнű1983          ááʱִнű1983Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű1983Ԫʧȥ        ʧʧԪʧȥʱִнű1983Ԫػý        ýýԪػýʱִнű1983ͼж        ضϡضϡͼжʱִнű1983̱          ̱ʱִнű1983ºɿ        ɡɡ̱ºɿʱִнű1983̱ɿ          ɡɡ̱ɿʱִнű1983걻          걻ʱִнű1983걻˫          ˫˫걻˫ʱִнű1983갴ť      󰴡󰴡갴ťʱִнű1983ƶ            ơơָƶʱִнű1983Ƴ            ָƳĳԪʱִнű1983ͣ            ָͣĳԪ֮ʱִнű1983갴ťɿ      ɡɡ갴ťɿʱִнű1983ŵ          ͡͡HTML <li> ǩ type 
HTML <ul> ǩ
÷
type Թ涨бебĿĿŵ͡
ʵ
 HTML бʹ type ԣ

<ol>
  <li>Coffee</li>
  <li type="a">Tea</li>
  <li>Milk</li>
</ol>

<ul>
  <li>Coffee</li>
  <li type="square">Tea</li>
  <li>Milk</li>
</ul>
TIY
֧
ܲ޳ʹ type ԣ֧ type ԡ
ע
 HTML 4.01 У޳ʹ li Ԫص type ԣ XHTML 1.0 Strict DTD У֧ li Ԫص type ԡ

ʹ CSS 档

CSS ﷨<li style="list-style-type:square">

CSS ʵбʽ

ǵ CSS ̳Уҵй list-style-type  ϸڡ
﷨
<li type="value">ֵ
бֵ

ֵ  
1 ˳бĬֵ1, 2, 3, 4 
a ĸ˳бСдa, b, c, d 
A ĸ˳бдa, b, c, d 
i ֣Сдi, ii, iii, iv 
I ֣дi, ii, iii, iv 

бֵ

ֵ  
disc ĬֵʵԲ 
circle Բ 
square ʵķ顣 
1983бĿ        ֵֵHTML <li> ǩ value 
HTML <ul> ǩ
÷
value Թ涨涨бĿ֡бĿӸֿʼС
ʵ
 HTML бʹ value ԣ

<ol>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
  <li value="100">Water</li>
  <li>Juice</li>
  <li>Beer</li>
</ol>
TIY
֧
ܲ޳ʹ value ԣ֧ value ԡ
ע
 HTML 4.01 У޳ʹ li Ԫص value ԣ XHTML 1.0 Strict DTD У֧ li Ԫص value ԡ

עͣĿǰûп value Ե CSS 
﷨
<li value="number">ֵ
ֵ  
number ǰбĿ֣ţ 
HTML <ul> ǩ
978Ŀ¼б            Ŀ¼бĿ¼бHTML <dir> ǩ
޳ʹ dir Ԫأ
÷
<dir> ǩĿ¼б
2012                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2012ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2012ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2012ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2012Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2012Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2012tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2012ĵ          ĵʱִнű2012ĵж          ж¡ж¡ĵжʱִнű2012Ԫظı            ııԪظıʱִнű2012ύ          ύύύʱִнű2012          ááʱִнű2012Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2012Ԫʧȥ        ʧʧԪʧȥʱִнű2012Ԫػý        ýýԪػýʱִнű2012ͼж        ضϡضϡͼжʱִнű2012̱          ̱ʱִнű2012ºɿ        ɡɡ̱ºɿʱִнű2012̱ɿ          ɡɡ̱ɿʱִнű2012걻          걻ʱִнű2012걻˫          ˫˫걻˫ʱִнű2012갴ť      󰴡󰴡갴ťʱִнű2012ƶ            ơơָƶʱִнű2012Ƴ            ָƳĳԪʱִнű2012ͣ            ָͣĳԪ֮ʱִнű2012갴ťɿ      ɡɡ갴ťɿʱִнű2012С            աաHTML <dir> ǩ compact 
HTML <dir> ǩ
÷
compact Թ涨бֵЧСɣͨмԼбʵֵġ
ʵ
Ŀ¼бʹ compact ԣ

<dir compact="compact">
   <li>HTML</li>
   <li>XHTML</li>
   <li>CSS</li>
</dir>
TIY
֧
κ֧ compact ԡ
ע
 HTML 4.01 У޳ʹ dir Ԫص compact ԣ XHTML 1.0 Strict DTD У֧ dir Ԫص compact ԡ

ʹ CSS 档

CSS ﷨<dir style="line-height: 80%">

CSS ʵСбеи

ǵ CSS ̳Уҵй line-height Եϸڡ
﷨
<dir compact="value">ֵ
ֵ  
compact 涨бָСɵЧ 
978б            ббHTML <dl> ǩ
÷
<dl> ǩ˶бdefinition list

<dl> ǩڽ <dt> беĿ <dd> беĿ
978бĿ      ĿĿHTML <dt> ǩ
÷
<dt> ǩ˶беĿﲿ֣
978бĿ  HTML <dd> ǩ
÷
<dd> ڶбжĿĶ岿֡
978˵б            ˵˵HTML <menu> ǩ
÷
<menu> ǩɶһ˵б
HTML  XHTML ֮Ĳ
 HTML 4.01 Уmenu Ԫز޳ʹá

 XHTML 1.0 Strict DTD Уmenu Ԫز֧֡
2043                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2043ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2043ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2043ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2043Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2043Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2043tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2043ĵ          ĵʱִнű2043ĵж          ж¡ж¡ĵжʱִнű2043Ԫظı            ııԪظıʱִнű2043ύ          ύύύʱִнű2043          ááʱִнű2043Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2043Ԫʧȥ        ʧʧԪʧȥʱִнű2043Ԫػý        ýýԪػýʱִнű2043ͼж        ضϡضϡͼжʱִнű2043̱          ̱ʱִнű2043ºɿ        ɡɡ̱ºɿʱִнű2043̱ɿ          ɡɡ̱ɿʱִнű2043걻          걻ʱִнű2043걻˫          ˫˫걻˫ʱִнű2043갴ť      󰴡󰴡갴ťʱִнű2043ƶ            ơơָƶʱִнű2043Ƴ            ָƳĳԪʱִнű2043ͣ            ָͣĳԪ֮ʱִнű2043갴ťɿ      ɡɡ갴ťɿʱִнű2043Deprecated. Use styles insteadաաDTD ָʾ DTD ʹáS=Strict, T=Transitional, F=Frameset.

 ֵ  DTD 
compact compact_rendering Deprecated. Use styles instead TF 
978ͼ                ͼͼHTML <img> ǩ
÷
img ԪҳǶһͼ

ע⣬ӼϽ<img> ǩҳвͼ񣬶Ǵҳͼ<img> ǩǱͼռλռ䡣

<img> ǩԣsrc   alt ԡ

2071                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2071ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2071ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2071ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2071Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2071Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2071tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2071ĵ          ĵʱִнű2071ĵж          ж¡ж¡ĵжʱִнű2071Ԫظı            ııԪظıʱִнű2071ύ          ύύύʱִнű2071          ááʱִнű2071Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2071Ԫʧȥ        ʧʧԪʧȥʱִнű2071Ԫػý        ýýԪػýʱִнű2071ͼж        ضϡضϡͼжʱִнű2071̱          ̱ʱִнű2071ºɿ        ɡɡ̱ºɿʱִнű2071̱ɿ          ɡɡ̱ɿʱִнű2071걻          걻ʱִнű2071걻˫          ˫˫걻˫ʱִнű2071갴ť      󰴡󰴡갴ťʱִнű2071ƶ            ơơָƶʱִнű2071Ƴ            ָƳĳԪʱִнű2071ͣ            ָͣĳԪ֮ʱִнű2071갴ťɿ      ɡɡ갴ťɿʱִнű2071ı            ġġHTML <img> ǩ alt 
HTML <img> ǩ
÷
alt һԣ涨ͼ޷ʾʱı

ԭû޷鿴ͼalt ԿΪͼṩϢ

?̫
?src еĴ
?ͼ
?ûʹõĻĶ
<img> ǩ alt ָıͼ޷ʾûͼʾʱͼʾеݡ

ǿƼĵÿͼжʹԡʹͼ޷ʾûǿԿڶʧʲôһЩϢҶڲм˵alt ͨ˽ͼݵΨһʽ
ʵ
<img src="/i/eg_tulip.jpg"  alt="Ϻʻ - " />һ

޷ʾͼʾı

 
⣬ûƵͼϷµһıʾıĴ alt Ϊͼı

԰ƶƬϣӦЧ

 
ȦеıûƶͼʱIE7 ʾЧ

 ʾעͣ
עͣalt Եֵһ԰ 1024 ַַаոͱ㡣ַС alt ıп԰ַʵãıǣǲκʽǩ

עͣûƶ img ԪʱInternet Explorer ʾ alt ԵֵΪȷ淶£ֻҪͼ޷ʾʱŻʾı

ʾҪΪͼ񴴽ʾʹ title ԡ
﷨
<a alt="value">ֵ
ֵ  
text 涨ͼı

alt ıʹԭ

?ͼϢ - ʹ alt ͼ
?ͼ a Ԫ - ʹ alt Ŀ
?ͼװ - ʹ alt=""
 
2071ͼļURL         ··HTML <img> ǩ src 
HTML <img> ǩ
÷
<img> ǩ src Ǳġֵͼļ URLҲøͼļĵľ··

ʾΪĵĴ洢ͨͼļһļУͨὫЩĿ¼Ϊ "pics"  "images" ֮ơ W3School ߽̳УǵĹʦѴ󲿷ֳõͼ񶼴ŵһΪ "i" ļУ"i" "images" дĺôǿ̶ȵؼ·
ʵ
Уҳвһ W3School ĹʦϺʻƬƬļ "eg_tulip.jpg"ڷϵ "i" ļСԴ룺

<img src="/i/eg_tulip.jpg" />ϴЧ

 
ʾǵ߲ԹһԣеļΪ"eg_chinarose.jpg"ῴһ¼Ƭ

Դ룺

<img src="/i/eg_chinarose.jpg" />ϴЧ

 ﷨
<a src="value">ֵ
ֵ  
URL 涨ͼ URL

ֵܵ

? URL - ָվ㣨 src="http://www.example.com/"
? URL - ָվڵļ src="/i/image.gif"
 
2071뷽ʽ            HTML <img> ǩ align 
HTML <img> ǩ
÷
<img> ǩ align ԶͼΧԪصˮƽʹֱ뷽ʽ

ϸ˵
׼ûжͼֺ䴦ͬһеͼĶϵHTML ͼгʱֻͨһ֡ͨӡˢý壬־ͼΧлƣͻкܶͼڣֻһС

˵ǣĵ߿ͨ <img> ǩ align ƴְΧͼĶ뷽ʽHTML  XHTML ׼ָ 5 ͼֵleftrighttop middle  bottomleft  right ֵͼΧıתƵӦı߽Уֵͼڵڴֱ϶롣Netscape  4 ֱִԣtexttopabsmiddlebaseline  absbottomInternet Explorer  center

ע⣺ͬԼͬһĲͬ汾 align ԵĳЩֵĴʽǲͬġ

ע⣺HTML 4.01 Ƽʹ align ԣXHTML 1.0 Strict DTD ָ֧ԣͬʱ HTML 5 Ҳָ֧ԡ
ʵ
ıеͼĶ뷽ʽ

<img src="/i/eg_cute.gif" align="middle" />һ
֧
Ȼ޳ʹ alignǼָ֧ԡ
ע
޳ʹ align Ժ <center> ǩ
HTML 4  XHTML вƼʹб׼е align ԣȻ <img>  align ԣԱʹʽͬʱʹ <center> ǩ

ȻԼǩ HTML зǳУеܺܺõ֧ǡԣȻ align  <center> һʧҪȴܳһʱ䡣


ʹ align  <center> ʱôأʹ HTML/XHTML ݡõķʹʽ磬margin-left  Զͼ float  ʵıΧͼЧ

ʵ
<img style="float:right" />һ
﷨
<img align="value" />ֵ
ֵ  
left ͼ뵽 
right ͼ뵽ұ 
middle ͼ 
top ͼ붥 
bottom ͼײ 
2071߿                ߿߿HTML <img> ǩ border 
HTML <img> ǩ
÷
<img> ǩ border Թ涨ͼΧı߿Ŀȣ˵ӻȥͼı߿

עͣĬϵأͼûб߿ģͼ a Ԫڲ

ͨѴӵͼ <a> ǩеͼʾؿı߿棬Աʾ߿ͨѡͼĵ

ʹ border ԺһرʾĿֵͿȥ (border="0") ӿͼı߿

ע⣺ HTML 4  XHTML ҲٱƼʹˣͬӦñʽ棬ȴȻܺõ֧š

Ķȥͼı߿
ʵ
 HTML Բͬϸͼ߿

<html>

<body>
<a href="/index.html">
<img src="/i/eg_logo_w3school.gif" border="1" />
</a>

<br />

<a href="/index.html">
<img src="/i/eg_logo_w3school.gif" border="2" />
</a>

<br />

<a href="/index.html">
<img src="/i/eg_logo_w3school.gif" border="4" />
</a>

<br />

<a href="/index.html">
<img src="/i/eg_logo_w3school.gif" border="8" />
</a>
</body>

</html>
һ
֧
ܲƼʹ border ԣָ֧ԡ
ʾע
עͣHTML 4.01 Ƽʹͼ "border" ԡ XHTML 1.0 Strict DTD  HTML 5 Уָ֧ԡ

ʾʹ CSS ı߿ ıԪصı߿ʽһⲿʽʹ CSS ߿ԣΪվϵͼһµı߿뵥Ϊһͼ border ȣַʽӵиߵЧʡ
ע
Ƽʹ img Ԫص border ԣ HTML 4.01 Strict Լ XHTML 1.0 Strict DTD У֧ img Ԫص border ԡ

ʹ CSS 档

CSS ﷨<img style="border:5px solid black">

CSS ʵͼ߿

ǵ CSS ̳Уҵй border  ϸڡ
﷨
<img border="value" />ֵ
ֵ  
pixels ߿ĿȣΪλ 
2071߶                ߡߡHTML <img> ǩ height  width 
HTML <img> ǩ
÷
<img> ǩ height  width ͼĳߴ硣

ʾΪͼָ height  width һϰߡЩԣͿҳʱΪͼԤռ䡣ûЩԣ޷˽ͼĳߴ磬Ҳ޷ΪͼʵĿռ䣬˵ͼʱҳĲ־ͻᷢ仯ƪϸ۵㣩

ʾ벻Ҫͨ height  width ͼͨ height  width Сͼôûͱشͼ񣨼ʹͼҳϿȥСȷǣҳʹͼ֮ǰӦͨͼΪʵĳߴ硣

Ķ height  width 
ʵ
ͼȺ͸߶ȷֱΪ 200 أ

<img src="/i/mouse.jpg" height="200" width="200" />һ
ʵ
ıͼС - ͼ
height  width һصԣָͼʵʴСҲ˵ֵԱʵʵĳߴһЩСһЩԶͼʹӦԤռĴСʹַͿԺ׵Ϊͼ񴴽ͼԼŴСͼ񡣵ҪעǣǱҪļʾĳߴ絽Ƕ󣬶ңûбԭĿȺ͸߶ȱͼᷢŤ

ʹ height  width ԵһּɣǿԷǳ׵ʵֶҳ䣬ͬʱԸĵܡһ£ĵзһɫĺҪһߴͼ෴ֻҪһȺ͸߶ȶΪ 1 صͼ񣬲ԼϣʹõɫȻʹ height  width ԰չĳߴ硣

<img src="/i/ct_1px.gif" width="200px" height="30px" /> HTML ЧɫֻһصͼƳɵģ

 
ʹðٷֱֵ
ʹ width Եһʹðٷֱֵصľֵ⽫ʹʾڵһͼˣҪһʾڿͬ߶Ϊ 30 صĲɫʵ֣

<img src="/i/ct_1px.gif" width="60%" height="30px" />ĵڵĴСıʱͼĴСҲ֮ı䣺

 
ʾṩһٷֱʽ width ֵ heightôǷŴСͼĿ߱ζͼĸ߶֮Ƚᷢ仯ͼҲͲᷢŤ

뿴 HTML

<img src="/i/ct_1px.gif" width="20%" />Ҳ˵ֻͼ ct_1px.gif  width ԵİٷֱֵõһͼΪԭʼ ct_1px.gif һֻ 1px ͸ߵľΣ

 
ʾǵ߲Թһԣ

ʾṩӵĿΪʹõ height  width Ե÷ֻҪĴɫװҳ棬ôõİ취ʹ CSS ɫ
֧
֧ height  width ԡ
﷨
<img height="value" />ߣ

<img width="value" />ֵ
ֵ  
pixels Ϊλĸ߶Ȼֵ 
percent ԰ԪصİٷֱȼƵĸ߶Ȼֵ 
2071                HTML <img> ǩ height  width 
HTML <img> ǩ
÷
<img> ǩ height  width ͼĳߴ硣

ʾΪͼָ height  width һϰߡЩԣͿҳʱΪͼԤռ䡣ûЩԣ޷˽ͼĳߴ磬Ҳ޷ΪͼʵĿռ䣬˵ͼʱҳĲ־ͻᷢ仯ƪϸ۵㣩

ʾ벻Ҫͨ height  width ͼͨ height  width Сͼôûͱشͼ񣨼ʹͼҳϿȥСȷǣҳʹͼ֮ǰӦͨͼΪʵĳߴ硣

Ķ height  width 
ʵ
ͼȺ͸߶ȷֱΪ 200 أ

<img src="/i/mouse.jpg" height="200" width="200" />һ
ʵ
ıͼС - ͼ
height  width һصԣָͼʵʴСҲ˵ֵԱʵʵĳߴһЩСһЩԶͼʹӦԤռĴСʹַͿԺ׵Ϊͼ񴴽ͼԼŴСͼ񡣵ҪעǣǱҪļʾĳߴ絽Ƕ󣬶ңûбԭĿȺ͸߶ȱͼᷢŤ

ʹ height  width ԵһּɣǿԷǳ׵ʵֶҳ䣬ͬʱԸĵܡһ£ĵзһɫĺҪһߴͼ෴ֻҪһȺ͸߶ȶΪ 1 صͼ񣬲ԼϣʹõɫȻʹ height  width ԰չĳߴ硣

<img src="/i/ct_1px.gif" width="200px" height="30px" /> HTML ЧɫֻһصͼƳɵģ

 
ʹðٷֱֵ
ʹ width Եһʹðٷֱֵصľֵ⽫ʹʾڵһͼˣҪһʾڿͬ߶Ϊ 30 صĲɫʵ֣

<img src="/i/ct_1px.gif" width="60%" height="30px" />ĵڵĴСıʱͼĴСҲ֮ı䣺

 
ʾṩһٷֱʽ width ֵ heightôǷŴСͼĿ߱ζͼĸ߶֮Ƚᷢ仯ͼҲͲᷢŤ

뿴 HTML

<img src="/i/ct_1px.gif" width="20%" />Ҳ˵ֻͼ ct_1px.gif  width ԵİٷֱֵõһͼΪԭʼ ct_1px.gif һֻ 1px ͸ߵľΣ

 
ʾǵ߲Թһԣ

ʾṩӵĿΪʹõ height  width Ե÷ֻҪĴɫװҳ棬ôõİ취ʹ CSS ɫ
֧
֧ height  width ԡ
﷨
<img height="value" />ߣ

<img width="value" />ֵ
ֵ  
pixels Ϊλĸ߶Ȼֵ 
percent ԰ԪصİٷֱȼƵĸ߶Ȼֵ 
2071ΧĿռ          հסհסHTML <img> ǩ hspace  vspace 
HTML <img> ǩ
÷
<img> ǩ hspace  vspace ԿͼΧĿռ䡣

ϸ˵
ͨͼͼΧ֮ܶռ䡣Ǵһ͸ͼ߿Щ࣬ͼΧ֮Ĭϵصľ룬ڴ˵̫ˡͼڳУɫı߿Ѿ˼м඼ռˣһʹע⵽ͼǶôӽ

hspace  vspace ԿԸͼһɺĿռ䡣ͨ hspaceΪλָͼߺұߵͼ֮ļࣻ vspace ֵͼ֮ľ

ȷͬһ㣬ҲЩͼΧĿռ䣬ʹıĶҳϿȥʤ
ʵ
ıеͼĶ뷽ʽ

<img src="w3school.gif" hspace="30" vspace="30" />һ
֧
Ȼ޳ʹ alignǼָ֧ԡ
ʾע
ʾⲿʽʹ CSS ߾Ժڱ߾ԣΪվϵͼһµı߾ࡣ뵥Ϊһͼ hspace  vspace ȣַʽӵиߵЧʡ
ע
Ƽʹ img Ԫص hspace  vspace ԣ HTML 4.01 Strict Լ XHTML 1.0 Strict DTD У֧ img Ԫص hspace  vspace ԡ

ʹ CSS 档

CSS ﷨<img style="margin: 0px 50px">

CSS ʵ߾ͼ

ǵ CSS ̳Уҵй margin  ϸڡ
﷨
<img hspace="value" />ߣ

<img vspace="value" />ֵ
ֵ  
pixels ΪλͼΧĿհס 
2071µͼ  հסհסHTML <img> ǩ hspace  vspace 
HTML <img> ǩ
÷
<img> ǩ hspace  vspace ԿͼΧĿռ䡣

ϸ˵
ͨͼͼΧ֮ܶռ䡣Ǵһ͸ͼ߿Щ࣬ͼΧ֮Ĭϵصľ룬ڴ˵̫ˡͼڳУɫı߿Ѿ˼м඼ռˣһʹע⵽ͼǶôӽ

hspace  vspace ԿԸͼһɺĿռ䡣ͨ hspaceΪλָͼߺұߵͼ֮ļࣻ vspace ֵͼ֮ľ

ȷͬһ㣬ҲЩͼΧĿռ䣬ʹıĶҳϿȥʤ
ʵ
ıеͼĶ뷽ʽ

<img src="w3school.gif" hspace="30" vspace="30" />һ
֧
Ȼ޳ʹ alignǼָ֧ԡ
ʾע
ʾⲿʽʹ CSS ߾Ժڱ߾ԣΪվϵͼһµı߾ࡣ뵥Ϊһͼ hspace  vspace ȣַʽӵиߵЧʡ
ע
Ƽʹ img Ԫص hspace  vspace ԣ HTML 4.01 Strict Լ XHTML 1.0 Strict DTD У֧ img Ԫص hspace  vspace ԡ

ʹ CSS 档

CSS ﷨<img style="margin: 0px 50px">

CSS ʵ߾ͼ

ǵ CSS ̳Уҵй margin  ϸڡ
﷨
<img hspace="value" />ߣ

<img vspace="value" />ֵ
ֵ  
pixels ΪλͼΧĿհס 
2071ͼӳ            ӳӳHTML <img> ǩ ismap 
HTML <img> ǩ
÷
ismap ԽͼΪͼӳ䡣

ͼӳָǴпɵͼ

һͼӳʱ URL ѯַʽ͵
ʵ
ͼӳ䣺

<a href="demo_form.asp">
<img src="tulip.gif" ismap="ismap" />
</a>
һ


ͼӳ ismap ʽΪ ˡͼӳ䣬ֻ <a> ǩʶĳ档

û ismap ͼϵĳʱԶ xy λãͼϽǣ͵ˡķڱ demo_form.asp 򣩿ԸЩӦ
֧
֧ ismap ԡ
﷨
<img ismap="ismap">2071ͼϢҳ      ҳҳHTML <img> ǩ longdesc 
HTML <img> ǩ
÷
longdesc Թ涨ָͼϢҳ URL

ϸϢ
<img> ǩ longdesc  alt ƣ֡longdesc ֵһָͼ˵ĵ URL˵ 1024 ַôʹ longdesc ָӡ

 HTML  XHTML ûָ˵бʲôݣĿǰû֧ longdesc ԡˣδЩǵĽǴһָҳ漴ɡ

alt Զڲм˺аԶ׼ԭǣlongdesc ƺǸõѡ
ʵ
ʹ longdesc ԣָһͼϢҳ棺

<img src="eg_logo_w3school.gif" alt="W3School.com.cn" longdesc="w3s.txt" />һ
֧
û֧ longdesc ԡ
﷨
<img longdesc="URL">ֵ
ֵ  
URL ָͼҳ URL

ֵܵ

? URL - ָվ㣨 longdesc="example.com/description.txt"
? URL - ָվڵļ longdesc="description.txt"
 
2071ͻͼӳ      ͻӳͻӳHTML <img> ǩ usemap 
HTML <img> ǩ
÷
usemap ԽͼΪͻͼӳ䡣

ͼӳָǴпɵͼ

usemap  map Ԫص name ͼӳ֮Ĺϵ

Ķ usemap 
ʵ
ͻͼӳ䣺

<img src="planets.gif" alt="Planets" usemap="#planetmap" />

<map name="planetmap">
  <area href="sun.htm" shape="rect" coords="0,0,110,260">Sun</a>
  <area href="mercur.htm" shape="circle" coords="129,161,10">Mercury</a>
  <area href="venus.htm" shape="circle" coords="180,139,14">Venus</a>
</map>
һ


Դ뽫һͼ planets.gif ӳΪ 3 򣬵ûĳһʱӵͬĵС

˽й map  area ԪصϢģ

?HTML <map> ǩ
?HTML <area> ǩ
֧
֧ usemap ԡ
﷨
<img usemap="value">ֵ
ֵ  
#mapname # + Ҫʹõ map Ԫ 
978ͼӳ            ͼͼHTML <map> ǩ
÷
һͻͼӳ䡣ͼӳ䣨image-mapָпɵһͼ
2109                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2109ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2109ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2109ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2109Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2109Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2109tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2109ĵ          ĵʱִнű2109ĵж          ж¡ж¡ĵжʱִнű2109Ԫظı            ııԪظıʱִнű2109ύ          ύύύʱִнű2109          ááʱִнű2109Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2109Ԫʧȥ        ʧʧԪʧȥʱִнű2109Ԫػý        ýýԪػýʱִнű2109ͼж        ضϡضϡͼжʱִнű2109̱          ̱ʱִнű2109ºɿ        ɡɡ̱ºɿʱִнű2109̱ɿ          ɡɡ̱ɿʱִнű2109걻          걻ʱִнű2109걻˫          ˫˫걻˫ʱִнű2109갴ť      󰴡󰴡갴ťʱִнű2109ƶ            ơơָƶʱִнű2109Ƴ            ָƳĳԪʱִнű2109ͣ            ָͣĳԪ֮ʱִнű2109갴ťɿ      ɡɡ갴ťɿʱִнű2109                ơ978ͼͼڲ  HTML <area> ǩ
÷
<area> ǩͼӳеעͼӳָǴпɵͼ񣩡

area ԪǶ <map> ǩС

עͣ<img> ǩе usemap  map Ԫ name ͼӳ֮ϵ
2137                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2137ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2137ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2137ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2137Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2137Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2137tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2137ĵ          ĵʱִнű2137ĵж          ж¡ж¡ĵжʱִнű2137Ԫظı            ııԪظıʱִнű2137ύ          ύύύʱִнű2137          ááʱִнű2137Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2137Ԫʧȥ        ʧʧԪʧȥʱִнű2137Ԫػý        ýýԪػýʱִнű2137ͼж        ضϡضϡͼжʱִнű2137̱          ̱ʱִнű2137ºɿ        ɡɡ̱ºɿʱִнű2137̱ɿ          ɡɡ̱ɿʱִнű2137걻          걻ʱִнű2137걻˫          ˫˫걻˫ʱִнű2137갴ť      󰴡󰴡갴ťʱִнű2137ƶ            ơơָƶʱִнű2137Ƴ            ָƳĳԪʱִнű2137ͣ            ָͣĳԪ֮ʱִнű2137갴ťɿ      ɡɡ갴ťɿʱִнű2137ı            ġġHTML <area> ǩ alt 
HTML <area> ǩ
÷
alt һԣ涨ͼ޷ʾʱı

ԭû޷鿴ͼalt ԿΪͼṩϢ

?̫
?src еĴ
?ͼ
?ûʹõĻĶ
<area> ǩ alt ָıͼ޷ʾûͼʾʱͼʾеݡ

ǿƼĵÿͼжʹԡʹͼ޷ʾûǿԿڶʧʲôһЩϢҶڲм˵alt ͨ˽ͼݵΨһʽ
ʵ
пɵͼӳ䣺

<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />

<map name="planetmap" id="planetmap">
  <area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus" />
  <area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" />
  <area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" />
</map>
TIY
֧
֧ alt Եķʽͬ
﷨
<area alt="value">ֵ
ֵ  
text ı 
HTML <area> ǩ
2137                HTML <area> ǩ coords 
HTML <area> ǩ
÷
coords Թ涨 x  y ꡣ

coords  shape ʹã涨ĳߴ硢״λá

ͼϽǵ "0,0"

ϸͣ
<area> ǩ coords Զ˿ͻͼӳжеꡣּ京ȡ shape о״ԽͻͼӳеĳΪΡԲλεȡ

гÿ״ʵֵ

ԲΣshape="circle"coords="x,y,z"
 x  y Բĵλã"0,0" ͼϽǵ꣩r ΪλԲΰ뾶

Σshape="polygon"coords="x1,y1,x2,y2,x3,y3,..."
ÿһ "x,y" 궼˶εһ㣨"0,0" ͼϽǵ꣩ҪꣻγҪĶ㡣

λԶգбĽβҪظһպ

Σshape="rectangle"coords="x1,y1,x2,y2"
һǾεһǵĶ꣬һǶԽǵĶ꣬"0,0" ͼϽǵꡣע⣬ʵǶĸĶεһּ򻯷

磬 XHTML Ƭһ 100x100 ͼ·ķ֮һһе򣬲ͼм䶨һԲ

<map name="map">
  <area shape="rect" coords="75,75,99,99" nohref="nohref">
  <area shape="circ" coords="50,50,25" nohref="nohref">
</map>
ʵ
<img src ="planets.gif" alt="Planets" usemap ="#planetmap" />

<map name="planetmap">
  <area shape="rect" coords="0,0,110,260" href="sun.htm" alt="Sun" />
  <area shape="circle" coords="129,161,10" href="mercur.htm" alt="Mercury" />
  <area shape="circle" coords="180,139,14" href="venus.htm" alt="Venus" />
</map>
TIY
ʾע
עͣĳ area ǩеصȲȳֵ area ǩԳͼ߽緶Χ֮ꡣ
﷨
<area coords="value">ֵ
ֵ  
x1,y1,x2,y2  shape Ϊ "rect"ֵ涨ϽǺ½ǵꡣ 
x,y,radius  shape Ϊ "circ"ֵ涨ԲĵͰ뾶 
x1,y1,x2,y2,..,xn,yn  shape Ϊ "poly"ֵ涨θߵꡣһһ겻һ£ôΪ˹رնΣһꡣ 
2137Ŀ            ĿĿHTML <area> ǩ href 
HTML <area> ǩ
÷
href Թ涨ӵĿꡣ
ʵ
пɵͼӳ䣺

<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />

<map name="planetmap" id="planetmap">
  <area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus" />
  <area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" />
  <area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" />
</map>
TIY
֧
֧ href ԡ
﷨
<area href="value">ֵ
ֵ  
URL ӵ URLֵܵ

? URL - ָһվ㣨 href="http://www.example.com/sun.htm"
? URL - ָվڵĳļhref="sun.htm"
?ê URL - ָҳеêhref="#sun"
 
2137û            HTML <area> ǩ nohref 
HTML <area> ǩ
÷
nohref Թ涨ûصӡ
ʵ
пɵ nohref Եͼӳ䣺

<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />

<map name="planetmap" id="planetmap">
  <area shape="circle" coords="180,139,14" nohref="nohref" alt="Venus" />
  <area shape="circle" coords="129,161,10" href="mercur.html" alt="Mercury" />
  <area shape="rect" coords="0,0,110,260" href="sun.html" alt="Sun" />
</map>
TIY
֧
֧ nohref ԡ
﷨
<area nohref="value">ֵ
ֵ  
nohref 涨ûصӡ 
2137״                ״״HTML <area> ǩ shape 
HTML <area> ǩ
÷
shape  coords ϣԹ涨ĳߴ硢״λá

ϸͣ
shape ڶͼӳже״

?ԲΣcirc  circle
?Σpoly  polygon
?Σrect  rectangle
shape ԵֵӰ coords ԵĽ͡δʹ shape ԣôʹֵ defaultձ׼default ζŸ򸲸ͼʵУĬʹþ򣬲ҵ 4  coords ֵûָ״ڱǩҲûа 4 ꣬ô

ʵϣNetscape Ψһʶ shape Ե default ֵṩһȫȵڳȵ㶨ķΧ֮ⵥ <map> ǩǲáȵá˳б뽫Ĭں档ĬḲͼӳгֵ

״ƵʵַûϸҪ磬ھΣNetscape 4 ʶ "rectangle"ȴʶ "rect"ԭǽʹдơ
ʵ
<img src ="planets.gif" alt="Planets" usemap ="#planetmap" />

<map name="planetmap">
  <area shape="rect" coords="0,0,110,260" href="sun.htm" alt="Sun" />
  <area shape="circle" coords="129,161,10" href="mercur.htm" alt="Mercury" />
  <area shape="circle" coords="180,139,14" href="venus.htm" alt="Venus" />
</map>
TIY
֧
֧ shape ԡ
﷨
<a shape="value">ֵ
ֵ  
default 涨ȫ 
rect  
circ ԲΡ 
poly  
2137򿪷ʽ            δδHTML <area> ǩ target 
HTML <area> ǩ
÷
target Թ涨ӵĿꡣ
ʵ
пɵͼӳ䣺

<img src="planets.jpg" border="0" usemap="#planetmap" alt="Planets" />

<map name="planetmap" id="planetmap">
  <area shape="circle" coords="180,139,14" href ="venus.html" alt="Venus"
  target=""_blank" />
  <area shape="circle" coords="129,161,10" href ="mercur.html" alt="Mercury" />
  <area shape="rect" coords="0,0,110,260" href ="sun.html" alt="Sun" />
</map>
TIY
֧
֧ target ԡ
﷨
<area target="value">ֵ
ֵ  
_blank ´д򿪱ĵ 
_self ĬϡͬĿд򿪱ĵ 
_parent ڸܼд򿪱ĵ 
_top д򿪱ĵ 
framename ָĿд򿪱ĵ 
978                HTML <table> ǩ
÷
<table> ǩ HTML 

򵥵 HTML  table ԪԼһ trth  td Ԫɡ

tr ԪضУth Ԫضͷtd ԪضԪ

ӵ HTML Ҳܰ captioncolcolgrouptheadtfoot Լ tbody Ԫء
2170                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2170ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2170ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2170ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2170Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2170Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2170tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2170ĵ          ĵʱִнű2170ĵж          ж¡ж¡ĵжʱִнű2170Ԫظı            ııԪظıʱִнű2170ύ          ύύύʱִнű2170          ááʱִнű2170Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2170Ԫʧȥ        ʧʧԪʧȥʱִнű2170Ԫػý        ýýԪػýʱִнű2170ͼж        ضϡضϡͼжʱִнű2170̱          ̱ʱִнű2170ºɿ        ɡɡ̱ºɿʱִнű2170̱ɿ          ɡɡ̱ɿʱִнű2170걻          걻ʱִнű2170걻˫          ˫˫걻˫ʱִнű2170갴ť      󰴡󰴡갴ťʱִнű2170ƶ            ơơָƶʱִнű2170Ƴ            ָƳĳԪʱִнű2170ͣ            ָͣĳԪ֮ʱִнű2170갴ťɿ      ɡɡ갴ťɿʱִнű2170뷽ʽ            HTML <table> ǩ align 
HTML <table> ǩ
÷
align Թ涨ΧԪصĶ뷽ʽ

ͨ˵HTML ǰ󶼻Сͨ align ԣʵ HTML ԪΧƱЧ
ʵ
һҶ HTML 

<table border="1" align="right">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>
TIY
ע
 HTML 4.01 У޳ʹ body Ԫص align ԣ XHTML 1.0 Strict DTD У֧ body Ԫص align ԡ

ʹ CSS 档

CSS ﷨<table style="float:right">

CSS ʵ뷽ʽ

ǵ CSS ̳Уҵй float Եϸڡ
﷨
<table align="value">ֵ
ֵ  
left  
right Ҷ 
center ж 
2170ɫ            ɫɫHTML <table> ǩ bgcolor 
HTML <table> ǩ
÷
bgcolor Թ涨涨ıɫ
ʵ
бɫ HTML 

<table border="1" bgcolor="#00FF00">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
ע
 HTML 4.01 У޳ʹ body Ԫص bgcolor ԣ XHTML 1.0 Strict DTD У֧ body Ԫص bgcolor ԡ

ʹ CSS 档

CSS ﷨<table style="background-color:red">

CSS ʵ񱳾ɫ

ǵ CSS ̳Уҵй background-color Եϸڡ
﷨
<body bgcolor="value">ֵ
ֵ  
color_name 涨ɫֵΪɫƵıɫ "red" 
hex_number 涨ɫֵΪʮֵıɫ "#ff0000" 
rgb_number 涨ɫֵΪ rgb ıɫ "rgb(255,0,0)" 
2170߿Ŀ          ߿߿HTML <table> ǩ border 
HTML <table> ǩ
÷
border Թ涨涨ΧƱı߿Ŀȡ

border ԻΪÿԪӦñ߿򣬲ñ߿ΧƱ border Եֵı䣬ôֻбΧ߿ĳߴᷢ仯ڲı߿ 1 ؿ

ʾ border="0"ʾûб߿ı

ʵýǶȳòҪ涨߿򣬶ʹ CSS ӱ߿ʽɫ
ʵ
ӰѱΧı߿Ϊ 8 ؿ

<table border="8">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
﷨
<body border="value">ֵ
ֵ  
pixels 涨߿ȡ 
2170ڱ߾              ڱ߾ڱ߾HTML <table> ǩ cellpadding 
HTML <table> ǩ
÷
cellpadding Թ涨Ԫ֮Ŀհס

עͣ𽫸 cellspacing cellspacing Թ涨ǵԪ֮Ŀռ䡣

ʵýǶȳòҪ涨 cellpaddingʹ CSS ڱ߾ࡣ
ʵ
ӰѱԪ߽뵥Ԫ֮ļΪ 10 أ

<table border="8" cellpadding="10">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
﷨
<body cellpadding="value">ֵ
ֵ  
pixels 涨Ԫ֮Ŀհס 
2170Ԫ֮      HTML <table> ǩ cellspacing 
HTML <table> ǩ
÷
cellspacing Թ涨Ԫ֮Ŀռ䡣

עͣ𽫸 cellpadding cellpadding Թ涨ǵԪ뵥Ԫ֮Ŀռ䡣
ʵ
ӰѱԪΪ 10 أ

<table border="8" cellspacing="10">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
﷨
<body cellspacing="value">ֵ
ֵ  
pixels 涨Ԫ֮Ŀռ䡣 
2170߿ɼ    ܡܡHTML <table> ǩ frame 
HTML <table> ǩ
÷
frame Թ涨߿ĸǿɼġ

ʵýǶȳòҪ涨 frameʹ CSS ӱ߿ʽ
ʵ
ӹ涨ֻΧƱı߿ǿɼģ

<table frame="box">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
 Internet Explorer֧ frame ԡ

עͣInternet Explorer ԲȷķʽʾԡIE ͬʱʾڵԪı߿򣨶߿򣩡

עͣSafari 2.0 İ汾ָ֧ԡ
﷨
<body frame="value">ֵ
ֵ  
void ʾ߿ 
above ʾϲ߿ 
below ʾ²߿ 
hsides ʾϲ²߿ 
vsides ʾߺұߵ߿ 
lhs ʾߵ߿ 
rhs ʾұߵ߿ 
box ĸʾ߿ 
border ĸʾ߿ 
2170ڲ߿ɼ    ڿɼڿɼHTML <table> ǩ rules 
HTML <table> ǩ
÷
rules Թ涨ڲ߿ĸǿɼġ

ʵýǶȳòҪ涨 rulesʹ CSS ӱ߿ʽ
ʵ
ӹ涨ֻ֮ı߿ǿɼģ

<table rules="rows">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
rules  Firefox  Opera пȷʾ

Internet ExplorerChrome Լ Safari 3 ԸԵʾȷ

?IE: ڲ߿򣬻 4 ߵ߿
?Chrome  Safariڲ߿򣬻 affected ߿
עͣSafari 2.0 ͸İ汾ָ֧ԡ
﷨
<body rules="value">ֵ
ֵ  
none û 
groups λ֮ 
rows λ֮ 
cols λ֮ 
all λк֮ 
2170ժҪ            ժҪժҪHTML <table> ǩ summary 
HTML <table> ǩ
÷
summary Թ涨ݵժҪ

summary ԲͨвκӾ仯

ĻĶøԡ
ʵ
Ӷ˱ݵժҪ

<table border="1" summary="Monthly savings for the Flintstones family">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
ڲͨвκӾЧжǷ֧ summary ԡ
﷨
<body summary="value">ֵ
ֵ  
text ݵժҪ 
2170                HTML <table> ǩ width 
HTML <table> ǩ
÷
width Թ涨Ŀȡ

û width ԣռҪĿռʾݡ

ʵýǶȳòҪ涨ȣʹ CSS Ӧÿȡ
ʵ
 400 ؿȵı

<table border="1" width="400">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
ڲͨвκӾЧжǷ֧ summary ԡ
﷨
<body width="value">ֵ
ֵ  
pixels ؼƵĿȣӣwidth="50" 
% ԰ԪصİٷֱȼƵĿȣӣwidth="50%" 
978            HTML <caption> ǩ
÷
caption Ԫض⡣

caption ǩ table ǩֻ֮ܶÿһ⡣ͨᱻڱ֮
2206                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2206ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2206ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2206ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2206Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2206Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2206tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2206ĵ          ĵʱִнű2206ĵж          ж¡ж¡ĵжʱִнű2206Ԫظı            ııԪظıʱִнű2206ύ          ύύύʱִнű2206          ááʱִнű2206Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2206Ԫʧȥ        ʧʧԪʧȥʱִнű2206Ԫػý        ýýԪػýʱִнű2206ͼж        ضϡضϡͼжʱִнű2206̱          ̱ʱִнű2206ºɿ        ɡɡ̱ºɿʱִнű2206̱ɿ          ɡɡ̱ɿʱִнű2206걻          걻ʱִнű2206걻˫          ˫˫걻˫ʱִнű2206갴ť      󰴡󰴡갴ťʱִнű2206ƶ            ơơָƶʱִнű2206Ƴ            ָƳĳԪʱִнű2206ͣ            ָͣĳԪ֮ʱִнű2206갴ťɿ      ɡɡ갴ťɿʱִнű2206뷽ʽ            HTML <caption> ǩ align 
HTML <caption> ǩ
÷
align Թ涨 caption ԪصĶ뷽ʽ

Խ caption ΪԪߡұߡײж롣
ʵ
ײ caption Ԫصı

<table border="1">
  <caption align="bottom">Monthly savings</caption>
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
 Firefox޷ȷ֧ align ԡ

ע֧ͣ "top"  "bottom" ֵChrome  Safari ֧ "left"  "right"Internet Explorer  Opera ֻܶ caption ڲı caption Ԫأж롣
ע
 HTML 4.01 У޳ʹ caption Ԫص align ԣ XHTML 1.0 Strict DTD У֧ caption Ԫص align ԡ

ʹ CSS 档

CSS ﷨<caption style="caption-side:left">

עͣ CSS  caption-side Եֲ֧Ǻܺá

CSS ʵλ

ǵ CSS ̳Уҵй caption-side Եϸڡ
﷨
<caption align="value">ֵ
ֵ  
left ڱߡ 
right ڱұߡ 
top ڱϱߡ 
bottom ڱ±ߡ 
978ͷԪ          ָָHTML <th> ǩ
÷
ڵıͷԪ

HTML ͵ĵԪ

?ͷԪ - ͷϢ th Ԫش
?׼Ԫ - ݣ td Ԫش
th ԪڲıͨΪеĴı td Ԫڵıͨͨı
2234                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2234ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2234ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2234ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2234Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2234Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2234tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2234ĵ          ĵʱִнű2234ĵж          ж¡ж¡ĵжʱִнű2234Ԫظı            ııԪظıʱִнű2234ύ          ύύύʱִнű2234          ááʱִнű2234Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2234Ԫʧȥ        ʧʧԪʧȥʱִнű2234Ԫػý        ýýԪػýʱִнű2234ͼж        ضϡضϡͼжʱִнű2234̱          ̱ʱִнű2234ºɿ        ɡɡ̱ºɿʱִнű2234̱ɿ          ɡɡ̱ɿʱִнű2234걻          걻ʱִнű2234걻˫          ˫˫걻˫ʱִнű2234갴ť      󰴡󰴡갴ťʱִнű2234ƶ            ơơָƶʱִнű2234Ƴ            ָƳĳԪʱִнű2234ͣ            ָͣĳԪ֮ʱִнű2234갴ťɿ      ɡɡ갴ťɿʱִнű2234д            ддHTML <th> ǩ abbr 
HTML <th> ǩ
÷
abbr Թ涨ͷԪݵд汾
abbr Բͨ web κӾЧı仯
ĻĶøԡ
ʵ
 HTML ʹ abbr ԣ
<table border="1">
  <tr>
    <th abbr="Company">Company in USA</th>
    <th>Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
ͨ web вκӾЧı仯˺˵Ƿڶ abbr Ե֧֡
﷨
<th abbr="value">
ֵ
ֵ	
text	ͷԪĶ2234ˮƽ            HTML <th> ǩ align 
HTML <th> ǩ
÷
align Թ涨ıͷԪݵˮƽ뷽ʽ
ʵ
ҶͷԪ HTML 
<table border="1">
  <tr>
    <th>Company in USA</th>
    <th align="right">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<th align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݡ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ2234ɫ            ɫɫHTML <th> ǩ bgcolor 
HTML <th> ǩ
÷
bgcolor Թ涨ͷԪıɫ
ʵ
бɫıͷԪ
<table border="1">
  <tr>
    <th bgcolor="#FF0000">Company in USA</th>
    <th bgcolor="#00FF00">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ bgcolor ԣ֧
ע
 HTML 4.01 УƼʹ th Ԫص bgcolor ԣ XHTML 1.0 Strict DTD У֧ th Ԫص bgcolor ԡ
ʹ CSS 档
CSS ﷨<th style="background-color:red">
CSS ʵбɫ
ǵ CSS ̳Уҵй background-color  ϸڡ
﷨
<th bgcolor="value">
ֵ
ֵ	
color_name	涨ɫֵΪɫƵıɫ "red"
hex_number	涨ɫֵΪʮֵıɫ "#ff0000"
rgb_number	涨ɫֵΪ rgb ıɫ "rgb(255,0,0)"2234ַ            ַַHTML <th> ǩ char 
HTML <th> ǩ
÷
char Թ涨ͷԪеĳַĶ뷽ʽ
 align Ϊ "char" ʱʹ char ԡ
char ԵĬֵҳԵСַ
ʵ
УһͷԪĵ "C" ַ룺
<table border="1">
  <tr>
    <th align="char" char="C">Company</th>
    <th>Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
û֧ char ԡ
﷨
<th char="value">
ֵ
ֵ	
character	涨ַ֮
2234ƫ          ƫơƫơHTML <th> ǩ charoff 
HTML <th> ǩ
÷
charoff  char Թ涨ַĶƫ
 align Ϊ "char"  char ʱʹ charoff ԡ
ʵ
УһͷԪĵ "C" ַҶַλö룺
<table border="1">
  <tr>
    <th align="char" char="C" charoff="2">Company</th>
    <th>Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
û֧ charoff ԡ
﷨
<th charoff="value">
ֵ
ֵ	
number	
涨뷽ʽ
涨ַұ߶롣
涨ַ߶롣
2234          ССHTML <th> ǩ colspan 
HTML <th> ǩ
÷
colspan Թ涨ͷԪɺ
ʵ
ͷԪеı
<table border="1">
  <tr>
    <th colspan="2">Company in USA</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
֧ colspan ԡ
û֧ colspan="0"ֵ塣μֵе
﷨
<th colspan="value">
ֵ
ֵ	
number	
õԪɺ
עͣcolspan="0" ָʾ絽һС2234ͷϢ            ϢϢHTML <th> ǩ headers 
HTML <th> ǩ
÷
headers Թ涨ͷ뵥Ԫ
headers ԲͨвκӾ仯
ĻĶøԡ
ϸ
headers ԻὫеһͷԪһݵԪϵ
ԵֵŰһƣЩ id ԶĲͬͷԪơ
headers ԶԷǿӻҲЩʾݵԪ֮ǰʾͷԪݵǳá
֧
ڲͨвκӾЧжǷ֧ headers ԡ
﷨
<th headers="value">
ֵ
ֵ	
idrefs	涨ԪһͷԪ id
2234߶                ߡߡHTML <th> ǩ height 
HTML <th> ǩ
÷
height Թ涨ıͷԪĸ߶ȡ
ͨԪռõĿռʾҪĿռ䡣height ΪԪԤĸ߶ȡ
ʵ
Ԥ߶ȵĵԪ
<table border="1">
  <tr>
    <th height="100px">Company in USA</th>
    <th height="100px">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ height ԣ֧
ע
 HTML 4.01 УƼʹ th Ԫص height ԣ XHTML 1.0 Strict DTD У֧ th Ԫص height ԡ
ʹ CSS 档
CSS ﷨<th style="height:100px">
CSS ʵñԪĸ߶
ǵ CSS ̳Уҵй height  ϸڡ
﷨
<th height="value">
ֵ
ֵ	
pixels	ؼƵĸ߶ֵ "100px"
percent	԰ԪذٷֱȼƵĸ߶ֵ "20%"
2234              ββHTML <th> ǩ nowrap 
HTML <th> ǩ
÷
nowrap Թ涨ͷԪеݲС
ʵ
 nowrap ԵıԪ
<table border="1">
  <tr>
    <th>Company in USA</th>
    <th nowrap="nowrap">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ nowrap ԣ֧
ע
 HTML 4.01 УƼʹ th Ԫص nowrap ԣ XHTML 1.0 Strict DTD У֧ th Ԫص nowrap ԡ
ʹ CSS 档
CSS ﷨<th style="white-space: nowrap">
CSS ʵth в
ǵ CSS ̳Уҵй white-space  ϸڡ
﷨
<th nowrap="value">
ֵ
ֵ	
nowrap	涨ͷԪеݲС
2234            ССHTML <th> ǩ rowspan 
HTML <th> ǩ
÷
rowspan Թ涨ͷԪɺ
ʵ
Ԫеı
<table border="1">
  <tr>
    <th>Company</th>
    <th>Address</th>
    <th rowspan="3">All the companies in USA</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
֧ rowspan ԡ
û֧ rowspan="0"ֵ塣μֵе
﷨
<th rowspan="value">
ֵ
ֵ	
number	
ñͷԪɺ
עͣrowspan="0" ָʾ絽񲿷ֵһУtheadtbody  tfoot
2234ֱ            HTML <th> ǩ valign 
HTML <th> ǩ
÷
valign Թ涨ԪݵĴֱзʽ
ʵ
вֱͬ뵥Ԫı
<table border="1" style="height:200px">
  <tr>
    <th valign="middle">Company</th>
    <th valign="bottom">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
</table>
TIY
֧
֧ valign ԡ
﷨
<th valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣2234                HTML <th> ǩ width 
HTML <th> ǩ
÷
width Թ涨ıͷԪĿȡ
ͨԪռõĿռʾҪĿռ䡣width ΪԪԤĿȡ
ʵ
ԤȵĵԪ
<table border="1">
  <tr>
    <th width="40%">Company in USA</th>
    <th width="60%">Address</th>
  </tr>
  <tr>
    <td>Apple, Inc.</td>
    <td>1 Infinite Loop Cupertino, CA 95014</td>
  </tr>
  <tr>
    <td>Google, Inc.</td>
    <td>1600 Amphitheatre Parkway Mountain View, CA 94043</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ width ԣ֧
ע
 HTML 4.01 У޳ʹ th Ԫص width ԣ XHTML 1.0 Strict DTD У֧ th Ԫص width ԡ
ʹ CSS 档
CSS ﷨<th style="width:100px">
CSS ʵñԪĿ
ǵ CSS ̳Уҵй width  ϸڡ
﷨
<th width="value">
ֵ
ֵ	
pixels	ؼƵĿֵ "100px"
percent	԰ԪذٷֱȼƵĿֵ "20%"
978е          ССHTML <tr> ǩ
÷
<tr> ǩ HTML еС

tr Ԫذһ th  td Ԫء
2273                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2273ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2273ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2273ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2273Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2273Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2273tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2273ĵ          ĵʱִнű2273ĵж          ж¡ж¡ĵжʱִнű2273Ԫظı            ııԪظıʱִнű2273ύ          ύύύʱִнű2273          ááʱִнű2273Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2273Ԫʧȥ        ʧʧԪʧȥʱִнű2273Ԫػý        ýýԪػýʱִнű2273ͼж        ضϡضϡͼжʱִнű2273̱          ̱ʱִнű2273ºɿ        ɡɡ̱ºɿʱִнű2273̱ɿ          ɡɡ̱ɿʱִнű2273걻          걻ʱִнű2273걻˫          ˫˫걻˫ʱִнű2273갴ť      󰴡󰴡갴ťʱִнű2273ƶ            ơơָƶʱִнű2273Ƴ            ָƳĳԪʱִнű2273ͣ            ָͣĳԪ֮ʱִнű2273갴ťɿ      ɡɡ갴ťɿʱִнű2273ˮƽ            HTML <tr> ǩ align 
HTML <tr> ǩ
÷
align Թ涨ݵˮƽ뷽ʽ
ʵ
ожеı
<table width="100%" border="1">
  <tr align="center">
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr align="center">
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<tr align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2273ɫ            ɫɫHTML <tr> ǩ bgcolor 
HTML <tr> ǩ
÷
bgcolor Թ涨еıɫ
ʵ
һдбɫ HTML 
<table width="100%" border="1">
  <tr bgcolor="#FF0000">
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ bgcolor ԣ֧
ע
 HTML 4.01 У޳ʹ tr Ԫص bgcolor ԣ XHTML 1.0 Strict DTD У֧ tr Ԫص bgcolor ԡ
ʹ CSS 档
CSS ﷨<tr style="background-color:red">
CSS ʵбɫ
ǵ CSS ̳Уҵй background-color Եϸڡ
﷨
<tr bgcolor="value">
ֵ
ֵ	
color_name	涨ɫֵΪɫƵıɫ "red"
hex_number	涨ɫֵΪʮֵıɫ "#ff0000"
rgb_number	涨ɫֵΪ rgb ıɫ "rgb(255,0,0)"
2273ַĶ          ַַHTML <tr> ǩ char 
HTML <tr> ǩ
÷
char Թ涨еĳַĶ뷽ʽ
 align Ϊ "char" ʱʹ char ԡ
char ԵĬֵҳԵСַ
ʵ
Уڶк͵е "." ַ룺
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr align="char" char=".">
    <td>January</td>
    <td>$100.00</td>
  </tr>
  <tr align="char" char=".">
    <td>February</td>
    <td>$10.00</td>
  </tr>
</table>
TIY
֧
û֧ char ԡ
﷨
<tr char="value">
ֵ
ֵ	
character	涨ַ֮
2273ֱ            HTML <tr> ǩ valign 
HTML <tr> ǩ
÷
valign Թ涨ݵĴֱ뷽ʽ
ʵ
вֱͬеı
<table width="100%" border="1">
  <tr valign="middle">
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr valign="bottom">
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
֧ valign ԡ
﷨
<tr valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣
baseline ֵ
һ鹹ߡһıУĸԻΪ׼baseline ֵебݶͬĻߡֵЧ bottom ֵͬıֺŸͬô baseline Чá뿴ͼʾ2273д            ддHTML <td> ǩ abbr 
HTML <td> ǩ
÷
abbr Թ涨Ԫݵд汾
abbr Բͨ web κӾЧı仯
ĻĶøԡ
ʵ
 HTML ʹ abbr ԣ
<table border="1">
  <tr>
    <th>Company</th>
    <th>Country</th>
  </tr>
  <tr>
    <td abbr="IBM">International Business Machine</td>
    <td>USA</td>
  </tr>
  <tr>
    <td abbr="ICBC">Industrial and Commercial Bank of China</td>
    <td>PRC</td>
  </tr>
</table>
TIY
֧
ͨ web вκӾЧı仯˺˵Ƿڶ abbr Ե֧֡
﷨
<td abbr="value">
ֵ
ֵ	
text	ԪĶ
978еԪ          HTML <td> ǩ
÷
<td> ǩ HTML еı׼Ԫ

HTML ൥Ԫ

?ͷԪ - ͷϢ th Ԫش
?׼Ԫ - ݣ td Ԫش
td ԪеıһʾΪ롣
2305                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2305ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2305ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2305ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2305Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2305Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2305tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2305ĵ          ĵʱִнű2305ĵж          ж¡ж¡ĵжʱִнű2305Ԫظı            ııԪظıʱִнű2305ύ          ύύύʱִнű2305          ááʱִнű2305Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2305Ԫʧȥ        ʧʧԪʧȥʱִнű2305Ԫػý        ýýԪػýʱִнű2305ͼж        ضϡضϡͼжʱִнű2305̱          ̱ʱִнű2305ºɿ        ɡɡ̱ºɿʱִнű2305̱ɿ          ɡɡ̱ɿʱִнű2305걻          걻ʱִнű2305걻˫          ˫˫걻˫ʱִнű2305갴ť      󰴡󰴡갴ťʱִнű2305ƶ            ơơָƶʱִнű2305Ƴ            ָƳĳԪʱִнű2305ͣ            ָͣĳԪ֮ʱִнű2305갴ťɿ      ɡɡ갴ťɿʱִнű2305д            ддHTML <td> ǩ abbr 
HTML <td> ǩ
÷
abbr Թ涨Ԫݵд汾
abbr Բͨ web κӾЧı仯
ĻĶøԡ
ʵ
 HTML ʹ abbr ԣ
<table border="1">
  <tr>
    <th>Company</th>
    <th>Country</th>
  </tr>
  <tr>
    <td abbr="IBM">International Business Machine</td>
    <td>USA</td>
  </tr>
  <tr>
    <td abbr="ICBC">Industrial and Commercial Bank of China</td>
    <td>PRC</td>
  </tr>
</table>
TIY
֧
ͨ web вκӾЧı仯˺˵Ƿڶ abbr Ե֧֡
﷨
<td abbr="value">
ֵ
ֵ	
text	ԪĶ2305ˮƽ            HTML <td> ǩ align 
HTML <td> ǩ
÷
align Թ涨Ԫݵˮƽ뷽ʽ
ʵ
Ҷ뵥Ԫ HTML 
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td align="right">$100</td>
  </tr>
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<td align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݡ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2305ɫ            ɫɫHTML <td> ǩ bgcolor 
HTML <td> ǩ
÷
bgcolor Թ涨Ԫıɫ
ʵ
бɫĵԪ
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td bgcolor="#FF0000">January</td>
    <td bgcolor="#00FF00">$100.00</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ bgcolor ԣ֧
ע
 HTML 4.01 У޳ʹ td Ԫص bgcolor ԣ XHTML 1.0 Strict DTD У֧ td Ԫص bgcolor ԡ
ʹ CSS 档
CSS ﷨<td style="background-color:red">
CSS ʵбɫ
ǵ CSS ̳Уҵй background-color Եϸڡ
﷨
<td bgcolor="value">
ֵ
ֵ	
color_name	涨ɫֵΪɫƵıɫ "red"
hex_number	涨ɫֵΪʮֵıɫ "#ff0000"
rgb_number	涨ɫֵΪ rgb ıɫ "rgb(255,0,0)"
2305            ССHTML <td> ǩ colspan 
HTML <td> ǩ
÷
colspan Թ涨Ԫɺ
ʵ
Ԫеı
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td colspan="2">January</td>
  </tr>
  <tr>
    <td colspan="2">February</td>
  </tr>
</table>
TIY
֧
֧ colspan ԡ
û֧ colspan="0"ֵ塣μֵе
﷨
<td colspan="value">
ֵ
ֵ	
number	
õԪɺ
עͣcolspan="0" ָʾ絽һС2305߶                ߡߡHTML <td> ǩ height 
HTML <td> ǩ
÷
height Թ涨Ԫĸ߶ȡ
ͨԪռõĿռʾҪĿռ䡣height ΪԪԤĸ߶ȡ
ʵ
Ԥ߶ȵĵԪ
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td height="100px">January</td>
    <td height="100px">$100.00</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80.00</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ height ԣ֧
ע
 HTML 4.01 У޳ʹ td Ԫص height ԣ XHTML 1.0 Strict DTD У֧ td Ԫص height ԡ
ʹ CSS 档
CSS ﷨<td style="height:100px">
CSS ʵñԪĸ߶
ǵ CSS ̳Уҵй height Եϸڡ
﷨
<td height="value">
ֵ
ֵ	
pixels	ؼƵĸ߶ֵ "100px"
percent	԰ԪذٷֱȼƵĸ߶ֵ "20%"
2305ݲ          ββHTML <td> ǩ nowrap 
HTML <td> ǩ
÷
nowrap Թ涨ԪеݲС
ʵ
 nowrap ԵıԪ
<table border="1">
  <tr>
    <th>Poem</th>
    <th>Poem</th>
  </tr>
  <tr>
    <td nowrap="nowrap">Never increase, beyond what is necessary, the 
	number of entities required to explain anything</td>
    <td>Never increase, beyond what is necessary, the number of entities 
	required to explain anything</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ nowrap ԣ֧
ע
 HTML 4.01 У޳ʹ td Ԫص nowrap ԣ XHTML 1.0 Strict DTD У֧ td Ԫص nowrap ԡ
ʹ CSS 档
CSS ﷨<td style="white-space: nowrap">
CSS ʵtd в
ǵ CSS ̳Уҵй white-space Եϸڡ
﷨
<td nowrap="value">
ֵ
ֵ	
nowrap	涨ԪеݲС2305            ССHTML <td> ǩ rowspan 
HTML <td> ǩ
÷
rowspan Թ涨Ԫɺ
ʵ
Ԫеı
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100.00</td>
    <td rowspan="2">$50</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$10.00</td>
  </tr>
</table>
TIY
֧
֧ rowspan ԡ
û֧ rowspan="0"ֵ塣μֵе
﷨
<td rowspan="value">
ֵ
ֵ	
number	
õԪɺ
עͣrowspan="0" ָʾ絽񲿷ֵһУtheadtbody  tfoot2305ֱ            HTML <td> ǩ valign 
HTML <td> ǩ
÷
valign Թ涨ԪݵĴֱзʽ
ʵ
вֱͬ뵥Ԫı
<table border="1">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td valign="top">January</td>
    <td valign="top">$100</td>
  </tr>
  <tr>
    <td valign="bottom">February</td>
    <td valign="bottom">$80</td>
  </tr>
</table>
TIY
֧
֧ valign ԡ
﷨
<td valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣2305                HTML <td> ǩ width 
HTML <td> ǩ
÷
width Թ涨ԪĿȡ
ͨԪռõĿռʾҪĿռ䡣width ΪԪԤĿȡ
ʵ
ԤȵĵԪ
<table border="1" width="100%">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td width="70%">January</td>
    <td width="30%">$100.00</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80.00</td>
  </tr>
</table>
TIY
֧
ܲ޳ʹ width ԣ֧
ע
 HTML 4.01 У޳ʹ td Ԫص width ԣ XHTML 1.0 Strict DTD У֧ td Ԫص width ԡ
ʹ CSS 档
CSS ﷨<td style="width:100px">
CSS ʵñԪĿ
ǵ CSS ̳Уҵй width Եϸڡ
﷨
<td width="value">
ֵ
ֵ	
pixels	ؼƵĿֵ "100px"
percent	԰ԪذٷֱȼƵĿֵ "20%"
978ͷ            ͷͷHTML <thead> ǩ
÷
<thead> ǩıͷñǩ HTML ıͷݡ

thead ԪӦ tbody  tfoot Ԫؽʹá

tbody Ԫڶ HTML еݽз飬 tfoot Ԫڶ HTML еıעҳţݽз顣

עͣʹ theadtfoot Լ tbody ԪأͱʹȫԪءǵĳִǣtheadtfoottbodyͿյǰҳˡ table ԪڲʹЩǩ

ʾĬЩԪزӰ쵽Ĳ֡ʹ CSS ʹЩԪظıۡ

ϸ
theadtfoot Լ tbody ԪʹԱенз顣ĳʱҲϣӵһУһЩݵУԼλڵײһܼСֻʹֶ֧ڱҳŵıĹı񱻴ӡʱıͷҳſɱӡڰݵÿҳϡ
2341                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2341ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2341ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2341ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2341Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2341Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2341tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2341ĵ          ĵʱִнű2341ĵж          ж¡ж¡ĵжʱִнű2341Ԫظı            ııԪظıʱִнű2341ύ          ύύύʱִнű2341          ááʱִнű2341Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2341Ԫʧȥ        ʧʧԪʧȥʱִнű2341Ԫػý        ýýԪػýʱִнű2341ͼж        ضϡضϡͼжʱִнű2341̱          ̱ʱִнű2341ºɿ        ɡɡ̱ºɿʱִнű2341̱ɿ          ɡɡ̱ɿʱִнű2341걻          걻ʱִнű2341걻˫          ˫˫걻˫ʱִнű2341갴ť      󰴡󰴡갴ťʱִнű2341ƶ            ơơָƶʱִнű2341Ƴ            ָƳĳԪʱִнű2341ͣ            ָͣĳԪ֮ʱִнű2341갴ťɿ      ɡɡ갴ťɿʱִнű2341ˮƽ            HTML <thead> ǩ align 
HTML <thead> ǩ
÷
align Թ涨 thead Ԫеݵˮƽ뷽ʽ
ʵ
 HTML  thead Ԫе룺
<table border="1" width="100%">
  <thead align="left">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<thead align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2341ֱ            HTML <thead> ǩ valign 
HTML <thead> ǩ
÷
valign Թ涨 thead ԪеݵĴֱ뷽ʽ
ʵ
 HTML  thead Ԫеݴֱж룺
<table border="1" width="100%">
  <thead valign="middle">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
</table>
TIY
֧
֧ valign ԡ
﷨
<thead valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣
baseline ֵ
һ鹹ߡһıУĸԻΪ׼baseline ֵеġ978        HTML <tbody> ǩ
÷
<tbody> ǩ壨ģñǩ HTML ݡ

tbody ԪӦ thead  tfoot Ԫؽʹá

thead Ԫڶ HTML еıͷݽз飬 tfoot Ԫڶ HTML еıעҳţݽз顣

עͣʹ theadtfoot Լ tbody ԪأͱʹȫԪءǵĳִǣtheadtfoottbodyͿյǰҳˡ table ԪڲʹЩǩ

ʾĬЩԪزӰ쵽Ĳ֡ʹ CSS ʹЩԪظıۡ

ϸ
theadtfoot Լ tbody ԪʹԱенз顣ĳʱҲϣӵһУһЩݵУԼλڵײһܼСֻʹֶ֧ڱҳŵıĹı񱻴ӡʱıͷҳſɱӡڰݵÿҳϡ
2370                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2370ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2370ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2370ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2370Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2370Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2370tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2370ĵ          ĵʱִнű2370ĵж          ж¡ж¡ĵжʱִнű2370Ԫظı            ııԪظıʱִнű2370ύ          ύύύʱִнű2370          ááʱִнű2370Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2370Ԫʧȥ        ʧʧԪʧȥʱִнű2370Ԫػý        ýýԪػýʱִнű2370ͼж        ضϡضϡͼжʱִнű2370̱          ̱ʱִнű2370ºɿ        ɡɡ̱ºɿʱִнű2370̱ɿ          ɡɡ̱ɿʱִнű2370걻          걻ʱִнű2370걻˫          ˫˫걻˫ʱִнű2370갴ť      󰴡󰴡갴ťʱִнű2370ƶ            ơơָƶʱִнű2370Ƴ            ָƳĳԪʱִнű2370ͣ            ָͣĳԪ֮ʱִнű2370갴ťɿ      ɡɡ갴ťɿʱִнű2370ˮƽ뷽ʽ        HTML <tbody> ǩ align 
HTML <tbody> ǩ
÷
align Թ涨 tbody Ԫеݵˮƽ뷽ʽ
ʵ
 HTML  tbody ԪеҶ룺
<table border="1" width="100%">
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
  <tbody align="right">
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<tbody align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2370ֱ            HTML <tbody> ǩ valign 
HTML <tbody> ǩ
÷
valign Թ涨 tbody ԪеݵĴֱ뷽ʽ
ʵ
 HTML  tbody Ԫеݴֱж룺
<table border="1" width="100%">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  <tbody valign="middle">
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
</table>
TIY
֧
֧ valign ԡ
﷨
<tbody valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣
baseline ֵ978бעݣעššHTML <tfoot> ǩ
÷
<tfoot> ǩҳţעעñǩ HTML еıעݡ

tfoot ԪӦ thead  tbody Ԫؽʹá

thead Ԫڶ HTML еıͷݽз飬 tbody Ԫڶ HTML еݽз顣

עͣʹ theadtfoot Լ tbody ԪأͱʹȫԪءǵĳִǣtheadtfoottbodyͿյǰҳˡ table ԪڲʹЩǩ

ʾĬЩԪزӰ쵽Ĳ֡ʹ CSS ʹЩԪظıۡ

ϸ
theadtfoot Լ tbody ԪʹԱенз顣ĳʱҲϣӵһУһЩݵУԼλڵײһܼСֻʹֶ֧ڱҳŵıĹı񱻴ӡʱıͷҳſɱӡڰݵÿҳϡ
2399                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2399ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2399ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2399ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2399Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2399Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2399tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2399ĵ          ĵʱִнű2399ĵж          ж¡ж¡ĵжʱִнű2399Ԫظı            ııԪظıʱִнű2399ύ          ύύύʱִнű2399          ááʱִнű2399Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2399Ԫʧȥ        ʧʧԪʧȥʱִнű2399Ԫػý        ýýԪػýʱִнű2399ͼж        ضϡضϡͼжʱִнű2399̱          ̱ʱִнű2399ºɿ        ɡɡ̱ºɿʱִнű2399̱ɿ          ɡɡ̱ɿʱִнű2399걻          걻ʱִнű2399걻˫          ˫˫걻˫ʱִнű2399갴ť      󰴡󰴡갴ťʱִнű2399ƶ            ơơָƶʱִнű2399Ƴ            ָƳĳԪʱִнű2399ͣ            ָͣĳԪ֮ʱִнű2399갴ťɿ      ɡɡ갴ťɿʱִнű2399ˮƽ            HTML <tfoot> ǩ align 
HTML <tfoot> ǩ
÷
align Թ涨 tfoot Ԫеݵˮƽ뷽ʽ
ʵ
 HTML  tfoot Ԫеݾж룺
<table border="1" width="100%">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  <tfoot align="center">
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>  
</table>
TIY
֧
֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<tfoot align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ2399ֱ            HTML <tfoot> ǩ valign 
HTML <tfoot> ǩ
÷
valign Թ涨 tfoot ԪеݵĴֱ뷽ʽ
ʵ
 HTML  tfoot Ԫе¶룺
<table border="1" width="100%">
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  <tfoot valign="bottom">
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>  
</table>
TIY
֧
֧ valign ԡ
﷨
<tfoot valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣978һеֵԡԡHTML <col> ǩ
÷
<col> ǩΪһжֵ

ȫӦʽ<col> ǩãͲҪԸԪ͸ظӦʽˡ

ֻ table  colgroup Ԫʹ <col> ǩ
2428                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2428ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2428ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2428ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2428Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2428Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2428tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2428ĵ          ĵʱִнű2428ĵж          ж¡ж¡ĵжʱִнű2428Ԫظı            ııԪظıʱִнű2428ύ          ύύύʱִнű2428          ááʱִнű2428Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2428Ԫʧȥ        ʧʧԪʧȥʱִнű2428Ԫػý        ýýԪػýʱִнű2428ͼж        ضϡضϡͼжʱִнű2428̱          ̱ʱִнű2428ºɿ        ɡɡ̱ºɿʱִнű2428̱ɿ          ɡɡ̱ɿʱִнű2428걻          걻ʱִнű2428걻˫          ˫˫걻˫ʱִнű2428갴ť      󰴡󰴡갴ťʱִнű2428ƶ            ơơָƶʱִнű2428Ƴ            ָƳĳԪʱִнű2428ͣ            ָͣĳԪ֮ʱִнű2428갴ťɿ      ɡɡ갴ťɿʱִнű2428ˮƽ            HTML <col> ǩ align 
HTML <col> ǩ
÷
align Թ涨 col Ԫصݵˮƽ뷽ʽ
ʵ
Уcol ԪΪей涨˲ͬĶ뷽ʽ
<table width="100%" border="1">
  <col align="left" />
  <col align="left" />
  <col align="right" />
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>
TIY
֧
ֻ Internet Explorer  Opera ֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<col align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2428            ЧЧHTML <col> ǩ span 
HTML <col> ǩ
÷
span Թ涨 col ԪӦú
ϸ
<col> ǩͬ <colgroup> ǩе span һ <col> ǩܹӰС
Ĭ£ֻӰһСٸӣһ 5 е <colgroup>Ƿֱ𽫵һкһпͿҶ룬моС
<colgroup>
  <col align="left" />
  <col align="center" span="3" />
  <col align="right" />
</colgroup>
ʵ
УжǾж룬Ϊ col ԪغУ
<table width="100%" border="1">
  <col span="3" align="center" />
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>
TIY
֧
֧ span ԡ
﷨
<col span="value">
ֵ
ֵ	
number	 col ԪӦú2428ֱ            HTML <col> ǩ valign 
HTML <col> ǩ
÷
valign Թ涨 col ԪصݵĴֱ뷽ʽ
ʵ
вֱͬ뷽ʽеı
<table border="1" style="height:200px">
  <col valign="top" />
  <col valign="bottom" />
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
֧ valign ԡ
עͣĿǰû֧ "baseline" ֵ
﷨
<col valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣
baseline ֵ
һ鹹ߡһıУĸԻΪ׼baseline ֵебݶͬĻߡֵЧ bottom ֵͬıֺŸͬô baseline Чá뿴ͼʾ2428                HTML <col> ǩ width 
HTML <col> ǩ
÷
width Թ涨 col ԪصĿȡ
ͨcol ԪռõĿռʾҪĿռ䡣width Ϊ col ԪԤĿȡ
עͣԻḲ colgroup Ԫеκοá
ʵ
Ԥȵ col Ԫأ
<table border="1" width="100%">
  <col width="100" />
  <col width="50" />
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>
TIY
֧
֧ width ԡ
עͣĿǰûָ֧Ե relative_length ֵ
﷨
<col width="value">
ֵ
ֵ	
pixels	ؼƵĿֵӣwidth="50"
percent	԰ΧԪصİٷֱȼƵĿֵӣwidth="50%"
relative_length	ѿط䵽֡
relative_length ֵ
Ŀ 100 أһ 20 أڶ 50%ôʣĿ 30 ء
 30pxôòһΪ "1*"ֶΪ "2*"⽫Ϊ 10  20 أ"1*" Ϊһ"2*" Ϊֶ978йʽHTML <colgroup> ǩ
÷
<colgroup> ǩڶԱенϣԱиʽ

ȫӦʽ<colgroup> ǩãͲҪԸԪ͸ظӦʽˡ

<colgroup> ǩֻ table Ԫʹá
2459                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2459ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2459ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2459ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2459Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2459Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2459tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2459ĵ          ĵʱִнű2459ĵж          ж¡ж¡ĵжʱִнű2459Ԫظı            ııԪظıʱִнű2459ύ          ύύύʱִнű2459          ááʱִнű2459Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2459Ԫʧȥ        ʧʧԪʧȥʱִнű2459Ԫػý        ýýԪػýʱִнű2459ͼж        ضϡضϡͼжʱִнű2459̱          ̱ʱִнű2459ºɿ        ɡɡ̱ºɿʱִнű2459̱ɿ          ɡɡ̱ɿʱִнű2459걻          걻ʱִнű2459걻˫          ˫˫걻˫ʱִнű2459갴ť      󰴡󰴡갴ťʱִнű2459ƶ            ơơָƶʱִнű2459Ƴ            ָƳĳԪʱִнű2459ͣ            ָͣĳԪ֮ʱִнű2459갴ťɿ      ɡɡ갴ťɿʱִнű2459ˮƽ            HTML <colgroup> ǩ align 
HTML <colgroup> ǩ
÷
align Թ涨еݵˮƽ뷽ʽ
ʵ
 colgroup ԪΪей涨˲ͬĶ뷽ʽʽעһ colgroup ԪغУ
<table width="100%" border="1">
  <colgroup span="2" align="left"></colgroup>
  <colgroup align="right" style="color:#0000FF;"></colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>
TIY
֧
ֻ Internet Explorer  Opera ֧ align ԡ
עͣIE ޷ȷش "justify" ֵIE Ծеķʽд
עͣûܹȷش "char" ֵ
﷨
<colgroup align="value">
ֵ
ֵ	
left	ݣĬֵ
right	Ҷݡ
center	жݣth ԪصĬֵ
justify	нչÿжȵĳȣڱֽ־У
char	ݶ׼ַָ
2459            ЧЧHTML <colgroup> ǩ span 
HTML <colgroup> ǩ
÷
span Թ涨Ӧú
ϸ
 <colgroup> ǩʹ spanɻõһ͡span Եֵ <colgroup> ǩܹӰ쵽
磬 6 еһ񣬵һ 4 Уڶ 2 УıԴʾ
<colgroup span="4"></colgroup>
<colgroup span="2"></colgroup>
еĴ뽫ԪϳʱὫÿǰĸԪϳɵһ飬Ԫϳɵڶ顣<colgroup> ǩԾͿڸˡ
ʵ
 colgroup ԪΪей涨˲ͬĶ뷽ʽʽעһ colgroup ԪغУ
<table width="100%" border="1">
  <colgroup span="2" align="left"></colgroup>
  <colgroup align="right" style="color:#0000FF;"></colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>
TIY
֧
֧ span ԡ
﷨
<colgroup span="value">
ֵ
ֵ	
number	Ӧú
2459ֱ            HTML <colgroup> ǩ valign 
HTML <colgroup> ǩ
÷
valign Թ涨еݵĴֱ뷽ʽ
ʵ
вֱͬ뷽ʽı
<table border="1" style="height:200px">
  <colgroup valign="top" />
  <colgroup valign="bottom" />
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
</table>
TIY
֧
֧ valign ԡ
עͣĿǰû֧ "baseline" ֵ
﷨
<colgroup valign="value">
ֵ
ֵ	
top	ݽ϶롣
middle	ݽож루Ĭֵ
bottom	ݽ¶롣
baseline	߶롣
baseline ֵ
һ鹹ߡһıУĸԻΪ׼baseline ֵебݶͬĻߡֵЧ bottom ֵͬıֺŸͬô 2459            HTML <colgroup> ǩ width 
HTML <colgroup> ǩ
÷
width Թ涨Ŀȡ
ͨռõĿռʾҪĿռ䡣width ΪԪԤĿȡ
עͣԻᱻ col Ԫеκοøǡ
ʵ
еԤֵ 100 أ
<table border="1">
  <colgroup span="2" width="100" />
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>$100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>$80</td>
  </tr>
</table>
TIY
֧
֧ width ԡ
עͣĿǰûָ֧Ե relative_length ֵ
﷨
<colgroup width="value">
ֵ
ֵ	
pixels	ؼƵĿֵӣwidth="50"
percent	԰ΧԪصİٷֱȼƵĿֵӣwidth="50%"
relative_length	ѿط䵽֡
relative_length ֵ
Ŀ 100 أһ 20 أڶ 50%ôʣĿ 30 ء
 30pxôòһΪ "1*"ֶΪ "2*"⽫Ϊ 10  20 أ"1*" Ϊһ"2*" Ϊֶ978ʽϢ            ʽʽHTML <style> ǩ
÷
<style> ǩΪ HTML ĵʽϢ

 style УԹ涨γ HTML ĵ

type Ǳģ style ԪصݡΨһֵܵ "text/css"

style Ԫλ head С
2490                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2490ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2490ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2490ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2490Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2490Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2490tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2490ĵ          ĵʱִнű2490ĵж          ж¡ж¡ĵжʱִнű2490Ԫظı            ııԪظıʱִнű2490ύ          ύύύʱִнű2490          ááʱִнű2490Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2490Ԫʧȥ        ʧʧԪʧȥʱִнű2490Ԫػý        ýýԪػýʱִнű2490ͼж        ضϡضϡͼжʱִнű2490̱          ̱ʱִнű2490ºɿ        ɡɡ̱ºɿʱִнű2490̱ɿ          ɡɡ̱ɿʱִнű2490걻          걻ʱִнű2490걻˫          ˫˫걻˫ʱִнű2490갴ť      󰴡󰴡갴ťʱִнű2490ƶ            ơơָƶʱִнű2490Ƴ            ָƳĳԪʱִнű2490ͣ            ָͣĳԪ֮ʱִнű2490갴ťɿ      ɡɡ갴ťɿʱִнű2490ʽ MIME   ͡͡HTML <style> ǩ type 
HTML <style> ǩ
÷
 type Թ涨ʽ MIME ͡
type ָʾ <style>  </style> ǩ֮ݡ
ֵ "text/css" ָʾǱ׼ CSS
ʵ
 <style> ǩʹ type ԣ
<html>
<head>
<style type="text/css">
h1 {color:red}
p {color:blue}
</style>
</head>

<body>
<h1>Header 1</h1>
<p>A paragraph.</p>
</body>
</html>
TIY
֧
֧ type ԡ
﷨
<style type="value">
ֵ
ֵ	
MIME_type	ʽ MIME ͡ĿǰΨһֵܵ "text/css"
2490ͬý涨ͬʽ豸豸HTML <style> ǩ media 
HTML <style> ǩ
÷
media Ϊͬý͹涨ͬʽ
ʾһ style Ԫжһϵýͣʹöŷָб磺<style type="text/css" media="screen,projection">
ʵ
ֲͬý͵ֲͬʽĻʹӡ
<html>
<head>
<style type="text/css">
h1 {color:#FF0000;}
p {color:#0000FF;}
body {background-color:#FFEFD6;}
</style>

<style type="text/css" media="print">
h1 {color:#000000;}
p {color:#000000;}
body {background-color:#FFFFFF;}
</style>
</head>

<body>
<h1>Header 1</h1>
<p>A paragraph.</p>
</body>
</html>
TIY
֧
֧ media Ե "screen""print" Լ "all" ֵ
ʾOpera ͬʱ֧ "handheld" ֵ
﷨
<style media="value">
ֵ
ֵ	
screen	ĻĬֵ
tty	紫ֻԼʹõȿַý顣
tv	豸ͷֱʡ޵Ļ
projection	ӳ
handheld	ֳ豸СĻ޵Ĵ
print	ӡԤģʽ / ӡҳ
braille	äõַ豸
aural	ϳ
all	ʺ豸978ĵн            ڡڡHTML <div> ǩ
÷
<div> ɶĵеķڣdivision/section

<div> ǩ԰ĵָΪġͬĲ֡ϸ֯ߣҲʹκθʽ

 id  class  <div>ôñǩûøЧ

÷
<div> һ鼶ԪءζԶؿʼһСʵϣ <div> еΨһʽ֡ͨ <div>  class  id Ӧöʽ

Ϊÿһ <div>  idȻҲһĺô

Զͬһ <div> ԪӦ class  id ԣǸֻӦһ֡ߵҪǣclass Ԫ飨ƵԪأ߿ΪĳһԪأ id ڱʶΨһԪء
2519                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2519ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2519ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2519ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2519Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2519Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2519tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2519ĵ          ĵʱִнű2519ĵж          ж¡ж¡ĵжʱִнű2519Ԫظı            ııԪظıʱִнű2519ύ          ύύύʱִнű2519          ááʱִнű2519Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2519Ԫʧȥ        ʧʧԪʧȥʱִнű2519Ԫػý        ýýԪػýʱִнű2519ͼж        ضϡضϡͼжʱִнű2519̱          ̱ʱִнű2519ºɿ        ɡɡ̱ºɿʱִнű2519̱ɿ          ɡɡ̱ɿʱִнű2519걻          걻ʱִнű2519걻˫          ˫˫걻˫ʱִнű2519갴ť      󰴡󰴡갴ťʱִнű2519ƶ            ơơָƶʱִнű2519Ƴ            ָƳĳԪʱִнű2519ͣ            ָͣĳԪ֮ʱִнű2519갴ťɿ      ɡɡ갴ťɿʱִнű2519ˮƽ            HTML <div> ǩ align 
HTML <div> ǩ
÷
align Թ涨 div Ԫеݵˮƽ뷽ʽ
ʵ
ĵеһ־ж룺
<div align="center">
  This is some text!
</div>
TIY
֧
֧ align ԡ
ע
 HTML 4.01 У޳ʹ div Ԫص align ԣ XHTML 1.0 Strict DTD У֧ div Ԫص align ԡ
ʹ CSS 档
CSS ﷨<div style="text-align:center">
CSS ʵ div Ԫеı
ǵ CSS ̳Уҵй text-align Եϸڡ
﷨
<div align="value">
ֵ
ֵ	
left	ݡ
right	Ҷݡ
center	жݡ
justify	нչÿжȵĳȣڱֽ־У
978Ԫ            ЧЧHTML <span> ǩ
÷
<span> ǩĵеԪء
978ͷ                ͷͷHTML <head> ǩ
÷
<head> ǩڶĵͷͷԪص<head> еԪؿýűָʾҵʽṩԪϢȵȡ

ĵͷĵĸԺϢĵı⡢ Web еλԼĵĹϵȡĵͷݶΪʾߡ

Щǩ head ֣<base>, <link>, <meta>, <script>, <style>, Լ <title>

<title> ĵı⣬ head ΨһԪ
2548                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2548ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2548ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2548ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2548Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2548Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2548tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2548ĵ          ĵʱִнű2548ĵж          ж¡ж¡ĵжʱִнű2548Ԫظı            ııԪظıʱִнű2548ύ          ύύύʱִнű2548          ááʱִнű2548Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2548Ԫʧȥ        ʧʧԪʧȥʱִнű2548Ԫػý        ýýԪػýʱִнű2548ͼж        ضϡضϡͼжʱִнű2548̱          ̱ʱִнű2548ºɿ        ɡɡ̱ºɿʱִнű2548̱ɿ          ɡɡ̱ɿʱִнű2548걻          걻ʱִнű2548걻˫          ˫˫걻˫ʱִнű2548갴ť      󰴡󰴡갴ťʱִнű2548ƶ            ơơָƶʱִнű2548Ƴ            ָƳĳԪʱִнű2548ͣ            ָͣĳԪ֮ʱִнű2548갴ťɿ      ɡɡ갴ťɿʱִнű2548ԪϢ          ԪϢԪϢһɿոָ URL бЩ URL йҳԪϢ978ĵ            HTML <title> ǩ
÷
<title> Ԫؿɶĵı⡣

ķʽʹñ⣬ͨڵı״̬ϡͬĵûбղؼлǩбʱ⽫ΪĵӵĬơ
2576                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2576ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2576ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2576ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2576Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2576Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2576tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2576ĵ          ĵʱִнű2576ĵж          ж¡ж¡ĵжʱִнű2576Ԫظı            ııԪظıʱִнű2576ύ          ύύύʱִнű2576          ááʱִнű2576Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2576Ԫʧȥ        ʧʧԪʧȥʱִнű2576Ԫػý        ýýԪػýʱִнű2576ͼж        ضϡضϡͼжʱִнű2576̱          ̱ʱִнű2576ºɿ        ɡɡ̱ºɿʱִнű2576̱ɿ          ɡɡ̱ɿʱִнű2576걻          걻ʱִнű2576걻˫          ˫˫걻˫ʱִнű2576갴ť      󰴡󰴡갴ťʱִнű2576ƶ            ơơָƶʱִнű2576Ƴ            ָƳĳԪʱִнű2576ͣ            ָͣĳԪ֮ʱִнű2576갴ťɿ      ɡɡ갴ťɿʱִнű2576ı            涨Ԫݵı򡣡2576Դ            涨ԪݵԴ롣2576ԪݵԴ  ԪݵԴԪݵԴ涨 XHTML ĵԪݵԴ롣978ԪϢ              ԪϢԪϢHTML <meta> ǩ
÷
<meta> ԪؿṩйҳԪϢmeta-information͸Ƶȵ͹ؼʡ

<meta> ǩλĵͷκݡ<meta> ǩԶĵ/ֵԡ
2606                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2606ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2606ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2606ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2606Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2606Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2606tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2606ĵ          ĵʱִнű2606ĵж          ж¡ж¡ĵжʱִнű2606Ԫظı            ııԪظıʱִнű2606ύ          ύύύʱִнű2606          ááʱִнű2606Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2606Ԫʧȥ        ʧʧԪʧȥʱִнű2606Ԫػý        ýýԪػýʱִнű2606ͼж        ضϡضϡͼжʱִнű2606̱          ̱ʱִнű2606ºɿ        ɡɡ̱ºɿʱִнű2606̱ɿ          ɡɡ̱ɿʱִнű2606걻          걻ʱִнű2606걻˫          ˫˫걻˫ʱִнű2606갴ť      󰴡󰴡갴ťʱִнű2606ƶ            ơơָƶʱִнű2606Ƴ            ָƳĳԪʱִнű2606ͣ            ָͣĳԪ֮ʱִнű2606갴ťɿ      ɡɡ갴ťɿʱִнű2606ԪϢ              ԪϢԪϢcontent ṩ/ֵеֵֵκЧַ
content ʼҪ name Ի http-equiv һʹá2606HTTP ͷ           HTTPͷHTTPͷhttp-equiv 
http-equiv Ϊ/ֵṩơָʾڷʵʵĵ֮ǰҪ͸ MIME ĵͷ/ֵԡ
ĵʱȷ/ֵԡȻЩᷢ/ֵԣзҪһcontent-type:text/html⽫׼һ HTML ĵ
ʹô http-equiv Ե <meta> ǩʱ/ֵӵ͸ͷ磬ӣ
<meta http-equiv="charset" content="iso-8859-1">
<meta http-equiv="expires" content="31 Dec 2008">
͵ͷӦð
content-type: text/html
charset:iso-8859-1
expires:31 Dec 2007
ȻֻԽЩӵͷֶΣʵķʽʹʱЩֶβ塣2606                 content Թһơ2606content ֵĸʽֵʽֵʽscheme 
scheme ָҪֵķ˷Ӧ <head> ǩ profile ָĸſļн˶塣978ӵĬϵַ  ַַHTML <base> ǩ
÷
<base> ǩΪҳϵӹ涨ĬϵַĬĿꡣ

ͨ£ӵǰĵ URL ȡӦԪд URL еĿհס

ʹ <base> ǩԸıһ㡣󽫲ʹõǰĵ URLʹָĻ URL е URLа <a><img><link><form> ǩе URL
2637                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2637ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2637ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2637ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2637Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2637Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2637tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2637ĵ          ĵʱִнű2637ĵж          ж¡ж¡ĵжʱִнű2637Ԫظı            ııԪظıʱִнű2637ύ          ύύύʱִнű2637          ááʱִнű2637Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2637Ԫʧȥ        ʧʧԪʧȥʱִнű2637Ԫػý        ýýԪػýʱִнű2637ͼж        ضϡضϡͼжʱִнű2637̱          ̱ʱִнű2637ºɿ        ɡɡ̱ºɿʱִнű2637̱ɿ          ɡɡ̱ɿʱִнű2637걻          걻ʱִнű2637걻˫          ˫˫걻˫ʱִнű2637갴ť      󰴡󰴡갴ťʱִнű2637ƶ            ơơָƶʱִнű2637Ƴ            ָƳĳԪʱִнű2637ͣ            ָͣĳԪ֮ʱִнű2637갴ťɿ      ɡɡ갴ťɿʱִнű2637׼ URL            ĿĿHTML <base> ǩ href 
HTML <base> ǩ
÷
href Թ涨ҳӵĻ׼ URL
ʵ
Ϊҳ URL 涨׼ URL
<head>
<base href="http://www.w3school.com.cn/i/" />
</head>

<body>
<img src="eg_smile.gif" />
</body>
TIY
﷨
<base href="value">
ֵ
ֵ	
URL	Ϊ׼ URL ľ URL "http://www.example.com/"
2637δ            δδHTML <base> ǩ target 
HTML <base> ǩ
÷
target Թ涨ںδҳϵӡ
ʵ
Ϊҳӹ涨ĬĿ꣺
<head>
<base target="_blank" />
</head>

<body>
<a href="http://www.w3school.com.cn">W3School</a>
</body>
TIY
﷨
<base target="value">
ֵ
ֵ	
_blank	´д򿪱ĵ
_self	ĬϡͬĿд򿪱ĵ
_parent	ڸܼд򿪱ĵ
_top	д򿪱ĵ
framename	ָĿд򿪱ĵ
978Ĭ塢ɫߴıԡıԡHTML <basefont> ǩ
÷
<basefont> ǩ׼塣ñǩΪĵеıĬɫСϵС
2666                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2666ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2666ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2666ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2666Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2666Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2666tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2666ĵ          ĵʱִнű2666ĵж          ж¡ж¡ĵжʱִнű2666Ԫظı            ııԪظıʱִнű2666ύ          ύύύʱִнű2666          ááʱִнű2666Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2666Ԫʧȥ        ʧʧԪʧȥʱִнű2666Ԫػý        ýýԪػýʱִнű2666ͼж        ضϡضϡͼжʱִнű2666̱          ̱ʱִнű2666ºɿ        ɡɡ̱ºɿʱִнű2666̱ɿ          ɡɡ̱ɿʱִнű2666걻          걻ʱִнű2666걻˫          ˫˫걻˫ʱִнű2666갴ť      󰴡󰴡갴ťʱִнű2666ƶ            ơơָƶʱִнű2666Ƴ            ָƳĳԪʱִнű2666ͣ            ָͣĳԪ֮ʱִнű2666갴ťɿ      ɡɡ갴ťɿʱִнű2666Ĭɫ            ɫɫHTML <basefont> ǩ color 
HTML <basefont> ǩ
÷
color Թ涨ĵıĬɫ
ʵ
涨ҳϵĬɫ
<head>
<basefont color="red" />
</head>

<body>
<h1>This is a header</h1>
<p>This is a paragraph</p>
</body>
TIY
֧
 Internet Explorer֧ color ԡ
ע
 HTML 4.01 У޳ʹ basefont Ԫص color ԣ XHTML 1.0 Strict DTD У֧ basefont Ԫص color ԡ
ʹ CSS 档
CSS ﷨ <head> ֣<style>body{color:red}</style>
CSS ʵΪҳ涨Ĭıɫ
ǵ CSS ̳Уҵйı color Եϸڡ
﷨
<basefont color="value">
ֵ
ֵ	
color_name	涨ɫֵΪɫƵɫ "red"
hex_number	涨ɫֵΪʮֵɫ "#ff0000"
rgb_number	涨ɫֵΪ rgb ɫ "rgb(255,0,0)"2666Ĭ            HTML <basefont> ǩ face 
HTML <basefont> ǩ
÷
face Թ涨ĵıĬ塣
ʵ
涨ҳϵĬ壺
<head>
<basefont face="courier, serif" />
</head>

<body>
<h1>This is a header</h1>
<p>This is a paragraph</p>
</body>
TIY
֧
 Internet Explorer֧ face ԡ
ע
 HTML 4.01 У޳ʹ basefont Ԫص face ԣ XHTML 1.0 Strict DTD У֧ basefont Ԫص face ԡ
ʹ CSS 档
CSS ﷨ <head> ֣<style>body{font-family: courier, serif}</style>
CSS ʵΪҳ涨Ĭı
ǵ CSS ̳Уҵй font-family Եϸڡ
﷨
<basefont face="value">
ֵ
ֵ	
font_family	涨ı塣涨ȱʹöŽƷֿ <basefont face="verdana,arial,sans-serif" />2666ĬϴС            ߴߴHTML <basefont> ǩ size 
HTML <basefont> ǩ
÷
size Թ涨ĵıĬϴСֺţ
ʵ
涨ҳϵĬС
<head>
<basefont size="7" />
</head>

<body>
<h1>This is a header</h1>
<p>This is a paragraph</p>
</body>
TIY
֧
 Internet Explorer֧ size ԡ
ע
 HTML 4.01 У޳ʹ basefont Ԫص size ԣ XHTML 1.0 Strict DTD У֧ basefont Ԫص size ԡ
ʹ CSS 档
CSS ﷨ <head> ֣<style>body{font-size: 10px}</style>
CSS ʵΪҳ涨Ĭıߴ
ǵ CSS ̳Уҵй font-size Եϸڡ
﷨
<basefont size="value">
ֵ
ֵ	
number	
涨ıߴ硣
ֵܵ 1  7 ֡Ĭֵ 3
978ͻ˽ű          ͻűͻűHTML <script> ǩ
÷
<script> ǩڶͻ˽ű JavaScript

script Ԫؼȿ԰ű䣬Ҳͨ src ָⲿűļ

 type Թ涨ű MIME ͡

JavaScript ĳӦʱͼ֤Լ̬ݸ¡
2696                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2696ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2696ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2696ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2696Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2696Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2696tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2696ĵ          ĵʱִнű2696ĵж          ж¡ж¡ĵжʱִнű2696Ԫظı            ııԪظıʱִнű2696ύ          ύύύʱִнű2696          ááʱִнű2696Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2696Ԫʧȥ        ʧʧԪʧȥʱִнű2696Ԫػý        ýýԪػýʱִнű2696ͼж        ضϡضϡͼжʱִнű2696̱          ̱ʱִнű2696ºɿ        ɡɡ̱ºɿʱִнű2696̱ɿ          ɡɡ̱ɿʱִнű2696걻          걻ʱִнű2696걻˫          ˫˫걻˫ʱִнű2696갴ť      󰴡󰴡갴ťʱִнű2696ƶ            ơơָƶʱִнű2696Ƴ            ָƳĳԪʱִнű2696ͣ            ָͣĳԪ֮ʱִнű2696갴ťɿ      ɡɡ갴ťɿʱִнű2696ű            ͡͡HTML <script> ǩ type 
HTML <script> ǩ
÷
 type Թ涨ű MIME ͡
type Աʶ <script>  </script> ǩ֮ݡ
MIME ɣýͺ͡ JavaScript MIME  "text/javascript"
type  language 
type  language Զָ <script> ǩеĽű͡
language  HTML  XHTML ׼ܵ˷飬׼ᳫʹ type ԡźǣԵֵǲһġ
ʹ JavaScriptʹԣ
language = "JavaScript"
ߣ
type = "text/javascript"
żῴ language ֵΪ VBScript type  text/vbscriptʾĽű Microsoft  Visual Basic Script дġ
 JavaScriptʹ language ֵ "JavaScript 1.1"ʾĽűֻܱ Netscape 3.0 µİ汾Netscape 2.0 ֻ֧ JavaScript 1.0޷Ϊ "JavaScript 1.1" Ľű
ʾϣѧϰй JavaScript  VBScript ֪ʶǵ JavaScript ̳̺ VBScript ̡̳
ʵ
 HTML ҳвһ JavaScript
<script type="text/javascript">
document.write("Hello World!")
</script>
TIY
﷨
<script type="value">
ֵ
ֵ	
MIME_type	
MIME ͡һЩֵ
text/javascript
text/ecmascript
application/ecmascript
application/javascript
text/vbscript2696ַ            HTML <script> ǩ charset 
HTML <script> ǩ
÷
charset Թ涨ⲿűļʹõַ롣
ⲿļеַļеı뷽ʽͬҪõ charset ԡ
Ĭϵַ ISO-8859-1
src  charset 
ر𳤵 JavaScript ߾ظʹõĳ˵ϣЩŵһļС£ͨ src Ǹļ
src ֵǰ JavaScript ļ URLļ MIME Ӧ application/x-javascriptļĺ׺Ϊ .jsҲܹȷ˵ķǡĴ
䣺
<script type="text/javascript" src="/w3school.com.cn/abc.js">....</script>
Ӹ֧ <script> ӷΪ abc.js  JavaScript 
Ҫע⣬<script> ǩûݣ </script> ǩҲǱġ
charset  src һʹã javascript ֵַκһ ISO ׼ַơ
ʵ
ⲿűļʹõַ룺
<script type="text/javascript" src="myscripts.js" charset="UTF-8"></script>
TIY
﷨
<script charset="value">
ֵ
ֵ	
character_encoding	
ⲿűļַ뷽ʽõַУ
UTF-8 - Unicode ַ
ISO-8859-1 - ĸַ
鿴пõַǵ ַοֲᡣ2696ӳٽű            ӳ١ӳ١HTML <script> ǩ defer 
HTML <script> ǩ
÷
defer Թ涨ǷԽűִнӳ٣ֱҳΪֹ
е javascript ű document.write ǰĵݣűͲһˡ
Ľűıĵݣɽ defer Լ뵽 <script> ǩУԱӿ촦ĵٶȡΪ֪ܹȫضȡĵʣಿִֶнűƳٶԽűĽֱͣĵѾʾûΪֹ
ʵ
defer Եʹã
<script type="text/javascript" defer="defer">
alert(document.getElementById("p1").firstChild.nodeValue);
</script>
TIY
֧
ֻ Internet Explorer ֧ defer ԡ
﷨
<script defer="value">
ֵ
ֵ	
defer	ӳٽűִС
2696ⲿű            ··HTML <script> ǩ src 
HTML <script> ǩ
÷
src Թ涨ⲿűļ URL
ʱҪվĶҳ JavaScriptҪظдͬĽűֻڵļд JavaScript .js Ϊ׺棬Ȼʹ <script> ǩе src øļɡ
עͣⲿļܰ <script> ǩ
ʵ
һⲿűļ
<script type="text/javascript" src="myscripts.js"></script>
TIY
﷨
<script src="value">
ֵ
ֵ	
URL	
ⲿű URLֵܵУ
 URL - ָվ㣨 src="www.example.com/example.js"
 URL - ָվڵļ src="/scripts/example.js"
978Բֿ֧ͻ˽űݼűűHTML <noscript> ǩ
÷
noscript Ԫڽűδִʱݣı

˱ǩɱڿʶ <script> ǩ޷֧еĽű
978Ƕ applet       Ƕ appletǶ appletHTML <applet> ǩ
÷
Ƕ applet
ʵ
һǶ Java applet

<applet code="Bubbles.class" width="350" height="350">
Java applet that draws animated bubbles.
</applet>
֧
ĳЩȻڶ <applet> ǩһЩ֧֣ҪĲͰװ̲á
HTML  XHTML ֮Ĳ
 HTML 4.01 У޳ʹ applet Ԫأ XHTML 1.0 Strict DTD У֧ applet Ԫء
ʾעͣ
ʾ applet뾡ܵʹ object ԪأΪ XHTML 1.0 Strict DTD Уapplet Ԫز֧֣
978Ƕ            HTML <object> ǩ
÷
һǶĶʹôԪ XHTML ҳӶý塣Ԫ涨 HTML ĵеĶݺͲԼʾͲݵĴ롣

<object> ǩڰ󣬱ͼƵƵJava appletsActiveXPDF Լ Flash

object ĳȡ img  applet Ԫء©Լȱ֧֣һ㲢δʵ֡

Ķ֧ڶ͡ҵǣʹòͬĴͬĶ͡

˵ǣobject ṩ˽δʾ object Ԫأͻִλ <object>  </object> ֮Ĵ롣ַͨʽܹǶ׶ object ԪأÿӦһ
2729                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2729ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2729ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2729ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2729Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2729Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2729tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2729ĵ          ĵʱִнű2729ĵж          ж¡ж¡ĵжʱִнű2729Ԫظı            ııԪظıʱִнű2729ύ          ύύύʱִнű2729          ááʱִнű2729Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2729Ԫʧȥ        ʧʧԪʧȥʱִнű2729Ԫػý        ýýԪػýʱִнű2729ͼж        ضϡضϡͼжʱִнű2729̱          ̱ʱִнű2729ºɿ        ɡɡ̱ºɿʱִнű2729̱ɿ          ɡɡ̱ɿʱִнű2729걻          걻ʱִнű2729걻˫          ˫˫걻˫ʱִнű2729갴ť      󰴡󰴡갴ťʱִнű2729ƶ            ơơָƶʱִнű2729Ƴ            ָƳĳԪʱִнű2729ͣ            ָͣĳԪ֮ʱִнű2729갴ťɿ      ɡɡ갴ťɿʱִнű2729뷽ʽ            ΧƸöı뷽ʽ2729ļ            ļļarchive 
Ϊܷԭ򣬿ѡԤذһеĶ󼯡Ի Java Ӧó˵ЩӦóУһ Java ཫںܶĹ
archive Եֵһ URL бÿ URL ָһʾִж֮ǰҪصĵļ2729Χ߿            ߿߿Χı߿򡣡2729 ID ֵ           ID ֵ ID ֵclassid 
classid ָаĶλãͨһ Java ࡣ
ֵǶľԻԵ URLṩ codebase ԵĻ URL  codebase ָ URL Եģڵǰĵ URL
磬Ϊִа clock.class ļеʱ Java applet HTML ĵаµĴ룺
<object classid="clock.class"></object>
õǰĵĻ URL Ϊ applet Ҵ롣ˣǰĵ URL ʾ
http://www.w3school.com.cn/time.html
еַΪǵ clock.class ʵȡ applet 룺
http://www.w3school.com.cn/clock.class
ʾclassid  <applet> ǩ code ƣṩ˰ļ2729׼ URL            ׼URL׼URLcodebase 
codebase һѡԣṩһ URLԵֵһ URL URL ָĿ¼ classid õĶ
codebase URL ḲĵĻ URLʹ codebase ԣ URL Ĭֵ
ڣǼʹǰǸӣĵԴ http://www.w3school.com.cnʱ applet һΪ classes ĵĿ¼Сָͨ classid= "classes/clock.class" ޷ applet෴Ҫ codebase ԺµĻ URL ڣ
<object classid="clock.class" codebase="http://www.w3school.com.cn/classes/">
</object>
ԽΪ URL
http://www.w3school.com.cn/classes/clock.class
ڴʹ˾ URLʵҲʹ URL磬applet ĵһ𱣴ͬһ̨ϣˣ¶λԵʣΪ codebase ָһԵ URLһЩ磺
<object classid="clock.class" codebase="/classes/">
</object>
ʾϼӿԿcodebase  classid ʹãָ URL2729            ͡͡codetype 
codetype ڱʶ͡
ֻ޷ classid Ծ applet  MIME ͣĳʱûдȷ MIME ͵£Ҫʹ codetype ԡ
codetype  type ơͬǣʶͣ type ʶļ͡
ʽظ֪Ĵ Java
<object codebase="clock.class" codetype="application/java">
</object>2729URL         URLURLdata 
data ָļ URL
Եֵļ URL URL ļ URL ľ URL  URL codebase ṩ URL ľԻ URL
ͨ뵽ĵеĶݵ͡
 <img> ǩе src ԣΪصҪɰдݡȻ֮Ĳڣdata κļͣͼļ2729ӳ            ӳءӳءdeclare 
declare ԿԶһ󣬵ͬʱֹغʹ
 name һʹʱڸΪͳıеĳǰܹӳضʱ䣬ֱȷʵĵеõӦá2729߶                ߡߡĸ߶ȡ2729ˮƽհ            հסհסΧˮƽĿհס2729                ΪΨһƣԱڽűʹã2729ʾı      ʾıʾı嵱ڼʱʾı2729            ͡͡屻涨 data ָļгֵݵ MIME ͡2729ͻͼӳ      ͻӳͻӳ涨һͬʹõĿͻͼӳ URL2729ֱհ        հסհסĴֱĿհס2729                Ŀȡ978            HTML <param> ǩ
÷
param ԪΪ XHTML ĵĶ涨 run-time ãҲ˵˱ǩΪ <object>  <applet> ǩṩ
2772                HTML class 
HTML ׼
ʵ
 HTML ĵʹ class ԣ
<html>
<head>
<style type="text/css">
h1.intro {color:blue;}
p.important {color:green;}
</style>
</head>

<body>
<h1 class="intro">Header 1</h1>
<p>A paragraph.</p>
<p class="important">Note that this is an important paragraph.</p>
</body>
</html>
һ
ڱҳײҵʵ
÷
class Թ涨Ԫصclassname
class ԴʱָʽеࣨclassҲͨ JavaScript ıָ class  HTML Ԫء
ʾע
עͣclass Բ HTML Ԫʹãbase, head, html, meta, param, script, style Լ title
ʾԸ HTML Ԫظ class磺<span class="left_menu important">ô԰ɸ CSS ϲһ HTML Ԫء
ʾֿͷֻ Internet Explorer ֧
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element class="value">
ֵ
ֵ	
classname	涨ԪصơΪһԪع涨࣬ÿոָ
2772ʶ                HTML id 
HTML ׼
ʵ
ͨ JavaScript  id ıһı
<html>
<head>
<script type="text/javascript">
function change_header()
{
document.getElementById("myHeader").innerHTML="Nice day!";
}
</script>
</head>

<body>
<h1 id="myHeader">Hello World!</h1>
<button onclick="change_header()">Change text</button>
</body>

</html>
һ
ڱҳײҵʵ
÷
id Թ涨 HTML ԪصΨһ id
id  HTML ĵбΨһġ
id Կêlink anchorͨ JavaScriptHTML DOMͨ CSS Ϊָ id Ԫظıʽ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element id="value">
ֵ
ֵ	
id	涨ԪصΨһ id
һ - ʵ
 HTML ԪΨһ id
 HTML Ԫ id ԡ
 CSS ʹ id 
 CSS ʹ id ԡ2772ʾı            HTML title 
HTML ׼
ʵ
 HTML ĵʹ title ԣ
<abbr title="People's Republic of China">PRC</abbr> was founded in 1949.
<p title="Free Web tutorials">W3School.com.cn</p>
һ
ڱҳײҵʵ
÷
title Թ涨ԪصĶϢ
ЩϢͨƵԪʱʾһιʾıtooltip text
ʾtitle Գ form Լ a ԪһͬʹãṩʽĿϢͬʱҲ abbr  acronym Ԫصıԡ
֧
W3C: "W3C" ָʾ W3C  HTML/XHTML Ƽ׼Ƿ˸ԡ
IE	Firefox	Opera	Safari	W3C
YES	YES	YES	YES	YES
﷨
<element title="value">
ֵ
ֵ	
text	涨ԪصĹʾıtooltip text
2772ı            HTML dir 
HTML ׼
ʵ
һηĶ䣺
<p dir="rtl">Write this text right-to-left!</p>
һ
֧
֧ dir ԡ
÷
dir Թ涨Ԫݵı
ʾע
עͣdir ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element dir="ltr|rtl">
ֵ
ֵ	
ltr	Ĭϡҵı
rtl	ı
2772Դ            HTML lang 
HTML ׼
ʵ
еһЩģ
<p lang="fr">Ceci est un paragraphe.</p>
һ
֧
֧ lang ԡ
÷
lang Թ涨Ԫݵԡ
ʾע
עͣlang ±ǩЧ<base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param> Լ <script>
﷨
<element lang="language_code">
ֵ
ֵ	
language_code	涨ԪݵԴ롣Դο2772Ԫؿݼ          HTML accesskey 
HTML ׼
ʵ
ָݼĳӣ
<a href="http://www.w3school.com.cn/html/" accesskey="h">HTML</a><br />
<a href="http://www.w3school.com.cn/css/" accesskey="c">CSS</a>
һ
֧
 accesskey ԣ Opera
÷
accesskey Թ涨ʹԪػý㣩ԪصĿݼ
ʾע
עͣԪ֧ accesskey ԣ<a>, <area>, <button>, <input>, <label>, <legend> Լ <textarea>
﷨
<element accesskey="character">
ֵ
ֵ	
character	涨ʹԪػý㣩Ԫصıݰ
2772tabƴ       tabtabHTML ׼
ʵ
ָ tab ˳ӣ
<a href="http://www.w3school.com.cn/" tabindex="2">W3School</a><br />
<a href="http://www.google.com/" tabindex="1">Google</a><br />
<a href="http://www.microsoft.com/" tabindex="3">Microsoft</a>
һ
֧
 tabindex ԣ Safari
÷
tabindex Թ涨Ԫص tab ƴ򣨵 tab ڵʱ
ʾע
עͣԪ֧ tabindex ԣ<a>, <area>, <button>, <input>, <object>, <select> Լ <textarea>
﷨
<element tabindex="number">
ֵ
ֵ	
number	涨Ԫص tab ƴ1 ǵһ2772ĵ          ĵʱִнű2772ĵж          ж¡ж¡ĵжʱִнű2772Ԫظı            ııԪظıʱִнű2772ύ          ύύύʱִнű2772          ááʱִнű2772Ԫرѡȡ          ѡȡѡȡԪرѡȡʱִнű2772Ԫʧȥ        ʧʧԪʧȥʱִнű2772Ԫػý        ýýԪػýʱִнű2772ͼж        ضϡضϡͼжʱִнű2772̱          ̱ʱִнű2772ºɿ        ɡɡ̱ºɿʱִнű2772̱ɿ          ɡɡ̱ɿʱִнű2772걻          걻ʱִнű2772걻˫          ˫˫걻˫ʱִнű2772갴ť      󰴡󰴡갴ťʱִнű2772ƶ            ơơָƶʱִнű2772Ƴ            ָƳĳԪʱִнű2772ͣ            ָͣĳԪ֮ʱִнű2772갴ťɿ      ɡɡ갴ťɿʱִнű2772                ƣڽűУ2772            ͡͡涨 MIME ͣinternet media type2772ֵ            ֵֵ涨ֵ2772ֵ            ֵֵ͡͡涨ֵ MIME ͡